Ad Widget

Collapse

Quick help: How to check last n values trigger

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zabbixfk
    Senior Member
    • Jun 2013
    • 256

    #1

    Quick help: How to check last n values trigger

    Hello,

    I know this seems a silly question, but i am not able quite get right how to set last two or more values to get result in trigger.
    Requirement: last two values to be zero.

    tried : min(#2)=0 , max(#2)=0 - didnt work - trigger fires when last value goes to zero.
    tried : sum(#2)=0 , didnt work out either
    tried : last(#1)=0 and last(#2)=0 - this resulted in getting all the host that trigger, i had to disable to bring back hosts from PROBLEM to OK. Basically false triggers.

    Can someone help me in understanding how these things work? I would like to check last two values, if they are zero then raise PROBLEM. If next value is non zero, then raise OK.

    Thanks
  • kaspars.mednis
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2017
    • 349

    #2
    Hello !

    min(#2)=0 will not work if all values are positive (one 0 will always be minimum vale)
    max(#2)=0 will work perfectly if all values are 0 or positive

    last(#1)=0 and last(#2)=0 also seems fine..

    can you post here whole trigger expression and item value range ?

    Regards,
    Kaspars

    Comment

    • zabbixfk
      Senior Member
      • Jun 2013
      • 256

      #3
      Quick help: How to check last n values trigger

      Thanks a lot for the reply.

      Basically i had couple of types of checks, Wanted to do two consecutive checks if they are zero, raise PROBLEM. and in next check, if first value becomes non zero, raise OK.

      Code:
      wan1-SNMP-interfaceNo-1:icmppingsec[,8,,,350,].min(#2)}=0
      Code:
      NW-Devices-Ping:icmpping[,8,,24,360].max(#3)}=0
      Code:
      {WAN-IP-Ping:icmppingsec[,8,,,600,].last(0)}=0
      What's the best way to do this?

      Thanks.

      Comment

      • kaspars.mednis
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Oct 2017
        • 349

        #4
        icmppingsec[,8,,,350,].min(#2)}=0 and icmppingsec[,8,,,350,].last(0)}=0 must work

        0 and 0 will return true - trigger in problem state
        1 and 0 will return true - trigger in problem state
        0 and 1 will return false - trigger in ok state
        1 and 1 will return false - trigger in ok state

        Regards,
        Kaspars

        Comment

        • zabbixfk
          Senior Member
          • Jun 2013
          • 256

          #5
          Quick help: How to check last n values trigger

          Thanks a lot for the reply.

          Can you elaborate this please, couldn't understand.
          0 , 0 = Problem
          1, 0 = Not problem, wait for next consecutive zero to raise the problem ( 1, 0 ,0 then only PROBLEM)
          1,1=OK
          0,1=OK only from previous PROBLEM state. ( example 0,0,1 it becomes PROBLEM to OK.).

          I want to make sure that, only when both last values are zero raise the trigger to PROBLEM.
          But after problem, if the value of the item becomes one, that means device is reachable, then make it OK.

          Thanks.
          Last edited by zabbixfk; 19-01-2018, 11:43. Reason: added comments

          Comment

          • kaspars.mednis
            Senior Member
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Oct 2017
            • 349

            #6
            sorry, problems with logic

            then simple expression - must be zeroes in both last values

            icmppingsec[,8,,,350,].last(#2)}=0 and icmppingsec[,8,,,350,].last(0)}=0 must work

            0 and 0 will return true - trigger in problem state
            1 and 0 will return false - trigger in ok state
            0 and 1 will return false - trigger in ok state
            1 and 1 will return false - trigger in ok state

            Comment

            • zabbixfk
              Senior Member
              • Jun 2013
              • 256

              #7
              Quick help: How to check last n values trigger

              Thanks a lot for the reply.

              Are you suggesting that, i use "last(#2)=0 and last(0)=0" and should work? I had tried "last(#1)=0 and last(#2)=0" but didn't work. Problem is i am on live environment, and one change applies to all. Can't see dashboard full of alerts

              PS. Sample varies from 1). 1,0,0,1 etc 2). 0.038 (38ms), 0, 0, 0.048 etc so for both this should work right?

              What does min and max do then? It would be great if you could help me understand.

              Thanks

              Comment

              • kaspars.mednis
                Senior Member
                Zabbix Certified Trainer
                Zabbix Certified SpecialistZabbix Certified Professional
                • Oct 2017
                • 349

                #8
                Here is an easy way to test you triggers:

                create some "Dummy" host;
                add some Zabbix trapper item to it (with key event.test.1 in this example)
                create a trigger, by example: {Dummy:event.test.1.last(#1)}=0 and {Dummy:event.test.1.last(#2)}=0
                with Zabbix sender utility send different values to this item and see results
                zabbix_sender -z 127.0.0.1 -s Dummy -k event.test.1 -o 0


                P.S
                Zabbix sender is another Zabbix application, must be installed first (yum install zabbix-sender on CentOS, apt-get install zabbix-sender Ubuntu)

                Comment

                • Mareg
                  Junior Member
                  • Feb 2018
                  • 2

                  #9
                  Hi I was looking for solution about this problem long time. Because the easy way - use avg() function in trigger doesn't work. Over it is easy. If I evaluate last n values for average, the trigger must fire only if ALL values are 0, if one of them is 1, the result must be more than 0 and trigger don't fire. That is true, but only if you have the type of the item for the trigger set to "Numeric (float)". I You have set it "Numeric (unsigned)", the result of the avg() function is zero after fist false value in the item history.

                  Mareg

                  Comment

                  Working...