Ad Widget

Collapse

triggers using sytem.run keys

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sid
    Member
    • Jul 2006
    • 44

    #1

    triggers using sytem.run keys

    Hello,

    I am trying to create a trigger where the key is a "system.run" command.

    For example, I would like to send a trigger if the Processor load on my RedHat box is greater than 2.

    The key I use to gather processor load values is:
    system.run[sar -q 1 1|tail -1|awk '{print $ 4}',wait]

    Here is the trigger expression i have:
    {myServer:system.run[sar -q 1 1|tail -1|awk '{print $ 4}',wait].last(0)}<=2

    This however give me errors. Can someone please tell me how to configure triggers with system.run commands as keys.
    Last edited by sid; 26-09-2006, 22:11.
  • peter_field
    Member
    • Jun 2006
    • 71

    #2
    Maybe use UserParameter in agent config

    I haven't used system.run, but another option if you don't have too many hosts might be the 'UserParameter' option in the agent.conf file.

    See:
    http://www.zabbix.com/manual/v1.1/config_files.php

    i.e.
    UserParameter=procload,sar -q 1 1|tail -1|awk '{print $ 4}'

    then you can setup an item with the key as 'procload', and a trigger based off that, like '{procload.last(0)}<=2'

    Hope that helps

    Comment

    • sid
      Member
      • Jul 2006
      • 44

      #3
      I thought about that.

      The problem is that I have about 300 servers across 6 different OSs. So it will be painstaking and it's not very dynamic.

      I wonder if there is a limitation about how keys are used in triggers- ie. only Zabbix native keys can be used and keys like 'system.run' cannot.

      Maybe Alexei can shed some light on this?

      Comment

      • peter_field
        Member
        • Jun 2006
        • 71

        #4
        Web interface may not accept symbols

        The other possibility is that the web interface will not accept the characters.

        I can't add the trigger:
        {Windows_t: perf_counter[\PhysicalDisk(_Total)\% Disk Time].min(600)}>50
        I presume this is due to the % symbol, I really haven't looked into it too much. I'd imagine your problem is the curley brackets. Maybe try putting a \ before the backets, i.e. system.run[sar -q 1 1|tail -1|awk '\{print $ 4\}',wait] when you are creating the trigger.

        I would try this on a non production system.

        Triggers reference items by itemid in the database, so if the web interface won't let you create the trigger with the system.run key, make the item with a more basic key that does work, create the trigger as you want it, then change the key of the item, and because the trigger only references the itemid, the trigger will change to the new key also.
        i.e.
        Create item with key 'testingblabla', set it to disabled.
        Create trigger '{myServer:testingblabla.last(0)}<=2'
        Then change the item key to 'system.run[sar -q 1 1|tail -1|awk '{print $ 4}',wait]',
        Check your trigger and it should now read '{myServer:system.run[sar -q 1 1|tail -1|awk '{print $ 4}',wait].last(0)}<=2'

        This fixed my % Disk Time problem.

        Hope that helps

        Peter

        Comment

        • Alexei
          Founder, CEO
          Zabbix Certified Trainer
          Zabbix Certified SpecialistZabbix Certified Professional
          • Sep 2004
          • 5654

          #5
          I'm not sure if the issues with "long and complex" keys and trigger expressions will be addressed in 1.1.x. It will require some rethinking and possibly changing a way how triggers and items should be configured.

          Anyway ZABBIX 1.4 will be free of such limitations.
          Alexei Vladishev
          Creator of Zabbix, Product manager
          New York | Tokyo | Riga
          My Twitter

          Comment

          • sid
            Member
            • Jul 2006
            • 44

            #6
            Peter's second method worked.

            The only problem is that it's not easy to change the trigger. After creating the trigger, if I want to change anything about it (comments, severity, threshold...etc), I would have to change the key for the host, and then change the trigger and then change the key again.

            So it's a lot running around to get a simple thing done.

            But thanks Peter, it's really intersting how you figured that out.

            Hopefully 1.4 will solve this.

            Comment

            Working...