Ad Widget

Collapse

Wrong expression results

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zedoras
    Junior Member
    • Nov 2014
    • 3

    #1

    Wrong expression results

    I am using Zabbix 2.4.0.
    I have created a trigger with the expression:
    {MyServer:icmppingsec[,2].last(#4)}=0

    which means that if the last 4 values/scans of ping of server 'MyServer' are 0 (no ping response), the trigger will be TRUE (so ping will be marked as 'PROBLEM').
    This works fine.

    The problem is when ping begins to respond again.
    According to the above expression, as soon as a new value of ping is a positive number (not 0), then the last 4 values won't be 0 (because the last one will be a positive number), so the trigger should be FALSE again and the ping should be marked as 'OK'.
    But it gets FALSE after 4 positive values, so it gets OK not as soon as the server goes up, but after 4 positive values of ping.
    If I use an interval of 2 minutes, I will get notified 8 minutes after the server goes up, which is to much!

    Shouldn't ping be marked as 'OK' at the first positive value?
    How can I achieve that?
    Last edited by zedoras; 05-11-2014, 19:23.
  • zedoras
    Junior Member
    • Nov 2014
    • 3

    #2
    Finally, the problem was in the expression.
    I read the manual more carefully, and realized that 'last(#4)' returns the 4th value, not the last 4 values.

    I changed it with max(#4), which returns the maximum value of the last 4 values, and now it works.

    Comment

    • kustodian
      Member
      • Oct 2012
      • 33

      #3
      Originally posted by zedoras
      I am using Zabbix 2.4.0.
      I have created a trigger with the expression:
      {MyServer:icmppingsec[,2].last(#4)}=0

      which means that if the last 4 values/scans of ping of server 'MyServer' are 0 (no ping response), the trigger will be TRUE (so ping will be marked as 'PROBLEM').
      This works fine.
      This is not correct. #NUM works differently for the last() function, compared to other functions like sum(), count(), etc. last(#4) is the 4th value before the last one, or to give an example: last(#1) is the last value (same as last(0), or just last() in 2.4), last(#2) is the value before it, etc.

      Originally posted by zedoras
      The problem is when ping begins to respond again.
      According to the above expression, as soon as a new value of ping is a positive number (not 0), then the last 4 values won't be 0 (because the last one will be a positive number), so the trigger should be FALSE again and the ping should be marked as 'OK'.
      But it gets FALSE after 4 positive values, so it gets OK not as soon as the server goes up, but after 4 positive values of ping.
      If I use an interval of 2 minutes, I will get notified 8 minutes after the server goes up, which is to much!

      Shouldn't ping be marked as 'OK' at the first positive value?
      How can I achieve that?
      Let me get this straight. You want the trigger to switch to PROBLEM after 4 consecutive unsuccessful pings, but it should turn to OK when the first ping goes through. For this you should use max():
      Code:
      {MyServer:icmppingsec[,2].max(#4)}=0
      This would turn to PROBLEM if the max value of the last 4 values is 0 (which means last 4 pings failed), when one ping goes through, max of the last 4 values will be greater than 0 and would return OK, which is exactly what you want.

      Comment

      Working...