Ad Widget

Collapse

Hysteresis with TRIGGER.VALUE

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Andreas Bollhalder
    Senior Member
    Zabbix Certified Specialist
    • Apr 2007
    • 144

    #1

    Hysteresis with TRIGGER.VALUE

    Hello

    As in the documentation 1.4rev7 under point 5.12.4, I tried to setup a trigger with an hysteresis for a temperature sensor:
    Code:
    ({TRIGGER.VALUE}=0&{sensor:temperatureTest.last(0)}>25)|({TRIGGER.VALUE}=1&{sensor:temperatureTest.last(0)}>20)
    I get
    Code:
    Incorrect trigger expression. Incorrect host is used.
    This one is working
    Code:
    {sensor:temperatureTest.last(0)}>25
    Is the macro TRIGGER.VALUE not working ?

    Andreas
    Zabbix statistics
    Total hosts: 380 - Total items: 12190 - Total triggers: 4530 - Required server performance: 224.2
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    Thanks for reporting this! I will check this and come up with a fix (if required).
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • Andreas Bollhalder
      Senior Member
      Zabbix Certified Specialist
      • Apr 2007
      • 144

      #3
      Hello Alexei

      I have upgraded to 1.4.1 and tried again. Lucky, I could create the trigger.

      Unfortunatly, this trigger from the documentation doesn't work
      Code:
      ({TRIGGER.VALUE}=0&{sensor:temperatureTest.last(0)}>25)|({TRIGGER.VALUE}=1&{sensor:temperatureTest.last(0)}>20)
      It returns always "OFF".

      The item is applied by a template and it has a value of 28 (°C).

      When I use only partial triggers with the expression
      Code:
      {TRIGGER.VALUE}=0&{sensor:temperatureTest(0)}>25
      or
      Code:
      {TRIGGER.VALUE}=1&{sensor:temperatureTest(0)}>20
      the trigger states are always "OFF".

      What I'm doing wrong here ?

      Andreas
      Last edited by Andreas Bollhalder; 04-07-2007, 07:57.
      Zabbix statistics
      Total hosts: 380 - Total items: 12190 - Total triggers: 4530 - Required server performance: 224.2

      Comment

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

        #4
        Please, see http://www.zabbix.com/forum/showthread.php?t=6692.
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • Andreas Bollhalder
          Senior Member
          Zabbix Certified Specialist
          • Apr 2007
          • 144

          #5
          I read the thread, but it doesn't help me with my expression. As far that I use the macro "TRIGGER.VALUE", my expression doesn't work. I tested more or less every possible combination with paranthesis to force a correct evaluation.

          Maybe another problem is related, which I have when using the "TRIGGER.VALUE" in the message of an action/operation. There I get wired values for it:
          Code:
          Value is {TRIGGER.VALUE}
          will be shown in the email with
          Code:
          Value is 583133714142199809
          I think, something is wrong here, as I expect the value of 0, 1 or 2.

          Andreas
          Zabbix statistics
          Total hosts: 380 - Total items: 12190 - Total triggers: 4530 - Required server performance: 224.2

          Comment

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

            #6
            Are you running ZABBIX on a 32 bit system? The patch is for you:

            Code:
            Index: src/zabbix_server/expression.c
            ===================================================================
            --- src/zabbix_server/expression.c	  (revision 4419)
            +++ src/zabbix_server/expression.c	  (working copy)
            @@ -1141,7 +1141,7 @@
            				{
            						var_len = strlen(MVAR_TRIGGER_VALUE);
            
            -					   replace_to = zbx_dsprintf(replace_to, ZBX_FS_UI64,
            +					   replace_to = zbx_dsprintf(replace_to, "%d",
            								event->value);
            				}
            				else if(macro_type & (MACRO_TYPE_MESSAGE_SUBJECT | MACRO_TYPE_MESSAGE_BODY) &&
            Alexei Vladishev
            Creator of Zabbix, Product manager
            New York | Tokyo | Riga
            My Twitter

            Comment

            • Andreas Bollhalder
              Senior Member
              Zabbix Certified Specialist
              • Apr 2007
              • 144

              #7
              Hello Alexei

              I'm using a 32-bit system and this patch works fine for the "TRIGGER.VALUE" in action/operation messages.

              Now I have the effect that the triggers are changing ON and OFF as described in the other thread. Will try again with paranthesis...

              Thanks a lot
              Andreas
              Zabbix statistics
              Total hosts: 380 - Total items: 12190 - Total triggers: 4530 - Required server performance: 224.2

              Comment

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

                #8
                Originally posted by Andreas Bollhalder
                Now I have the effect that the triggers are changing ON and OFF as described in the other thread. Will try again with paranthesis...
                It is also already fixed.
                Alexei Vladishev
                Creator of Zabbix, Product manager
                New York | Tokyo | Riga
                My Twitter

                Comment

                • Andreas Bollhalder
                  Senior Member
                  Zabbix Certified Specialist
                  • Apr 2007
                  • 144

                  #9
                  I think you mean the presedence of operators/paranthesis handling is fixed ?

                  Now, I have the trigger defined as followed:
                  Code:
                  ({TRIGGER.VALUE}=0&({sensor:temperatureTest.last(0)}>30))|({TRIGGER.VALUE}=1&({sensor:temperatureTest.last(0)}>27))
                  The item "temperatureTest" has a value of 28 (°C). As described in the example of the documentation, the trigger will be come true if the temperature is over 30°C and stays true till the temperature is below 27 °C. But in my case, the trigger is true with 28°C and it has been never over 30°C.

                  I don't understand the following with this trigger:
                  Code:
                  0&({sensor:temperatureTest.last(0)}>30)
                  As far as I see, this expression would always return 0. What will it do here exactly ? I'm really confused.

                  I'm trying to implement a hysteresis as described in the documentation.

                  Andreas
                  Zabbix statistics
                  Total hosts: 380 - Total items: 12190 - Total triggers: 4530 - Required server performance: 224.2

                  Comment

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

                    #10
                    I explained earlier, precedence of operators is not C syle in 1.4.1. It is fixed in pre 1.4.2 though. Add more brackets for now:

                    Code:
                    (({TRIGGER.VALUE}=0)&({sensor:temperatureTest.last(0)}>30))
                    |
                    (({TRIGGER.VALUE}=1)&({sensor:temperatureTest.last(0)}>27))
                    Alexei Vladishev
                    Creator of Zabbix, Product manager
                    New York | Tokyo | Riga
                    My Twitter

                    Comment

                    • Andreas Bollhalder
                      Senior Member
                      Zabbix Certified Specialist
                      • Apr 2007
                      • 144

                      #11
                      Hello Alexei

                      Sorry that I couldn't replay earlier. I have been confused and imagined that "{TRIGGER.VALUE}=x" would set the trigger value to the value x, which is plain false. I managed to implement the trigger yesterday morning, but couldn't test it to see if it works fine. Have been out working up to 2:00am at a place of a customer...

                      My tested trigger now looks like this:
                      Code:
                      ({server:temp.last(0)}>20)|(({TRIGGER.VALUE}=1)&({server:temp.last(0)}>15))
                      I have ommited the "({TRIGGER.VALUE}=0)&" part, as I believe it's not needed and the trigger above works fine for me.

                      Sorry for keeping you busy with this.

                      Andreas
                      Last edited by Andreas Bollhalder; 09-07-2007, 08:21.
                      Zabbix statistics
                      Total hosts: 380 - Total items: 12190 - Total triggers: 4530 - Required server performance: 224.2

                      Comment

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

                        #12
                        No problem. By the way, you may also try pre 1.4.2 from http://www.zabbix.com/developers.php to check if new operator precedence works fine.
                        Alexei Vladishev
                        Creator of Zabbix, Product manager
                        New York | Tokyo | Riga
                        My Twitter

                        Comment

                        • dmz
                          Junior Member
                          • Jun 2005
                          • 26

                          #13
                          Same idea but with log and regexp

                          I am trying to do a similar thing but with log[] & regexp, but can't get it to do anything if I add {TRIGGER.VALUE}=X.

                          Here are a few that I have tried, let me know if I've done this wrong:
                          This works:
                          ({SERVER:log[logfile].regexp(ERROR)}>0)

                          This doesn't:
                          (({TRIGGER.VALUE}=0)&({SERVER:log[logfile].regexp(ERROR)}>0))

                          This doesn't:
                          ({SERVER:log[logfile].regexp(ERROR)}>0)|(({TRIGGER.VALUE}=1)&({SERVER:l og[logfile].regexp(OKMSG)}=0))

                          The last is what i'm really hoping for where the trigger goes on if log sees regex or log doesn't see regex saying things are OK & trigger is already on

                          Any thoughts?
                          David

                          Followup:
                          I added the patch mentioned in http://www.zabbix.com/forum/showthre...hlight=trigger and got the TRIGGER.VALUE working.

                          Now I'm trying to figure out how to know if any acknowledgments have been entered for the trigger..
                          Last edited by dmz; 25-07-2007, 07:28.

                          Comment

                          • bortolas
                            Junior Member
                            • Oct 2007
                            • 2

                            #14
                            same problem

                            Im facing this same problem. But I already made the upgrade to 1.4.2. It seems the patch posted in the thread is applied already.
                            I have configured the body of the messages in the actions in the following way:
                            {TRIGGER.NAME}: {STATUS} : {TRIGGER.VALUE}

                            The incoming text always is (the third field value is invalid):
                            ---------------
                            Low free disk space on XXXXX volume YYYY: ON : 579872262006505473
                            ---------------

                            Zabbix is running in a 32 bit system.

                            Any suggestion to solve the problem?
                            thanks.

                            Comment

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

                              #15
                              Make sure that you are running 1.4.2. Note that starting from 1.4.2 ZABBIX binaries go to sbin/ not to bin/ as before.
                              Alexei Vladishev
                              Creator of Zabbix, Product manager
                              New York | Tokyo | Riga
                              My Twitter

                              Comment

                              Working...