Ad Widget

Collapse

Trigger - test for value 0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • norbhinn
    Junior Member
    • Jun 2021
    • 3

    #1

    Trigger - test for value 0

    Hello,

    I'm trying to make a trigger that checks if an snmp value have been over 0 at one point for instance last 24 hours. So i figured that I will du sum() and test last 24h for 0. If sum() is still 0, then trigger. The issue is that when I apply the template the trigger ignores that it actually do not have enough sample to trigger this issue. If the last value is 0, its seems like it assumes that all no data is also 0, and trigger an alarm.

    So, how do I make zabbix take into account that it actually do not have enough samples to trigger?

    sum(/template/key[{#SNMPVALUE}],24h) = 0

    Thanks!
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1782

    #2
    Hi, do you have the same problem if you use max() instead of sum()?

    Markku

    Comment

    • Semiadmin
      Senior Member
      • Oct 2014
      • 1625

      #3
      max(/template/key[{#SNMPVALUE}],24h) = 0 and last(/template/key[{#SNMPVALUE}],#1:now-1d) >= 0

      Comment

      • norbhinn
        Junior Member
        • Jun 2021
        • 3

        #4
        Originally posted by Semiadmin
        max(/template/key[{#SNMPVALUE}],24h) = 0 and last(/template/key[{#SNMPVALUE}],#1:now-1d) >= 0
        Hi,

        Only max did not work, but 'Semiadmin' solution did work. I noticed that my original post might be a bit confusing. The trigger should be fired if the value the last 24h have all been 0. The alarm clears if the last value is more then 1.

        Q: Why did you put >= 0 in the last statement?

        Trying to understand the last statement, is it correct that it test the first value 1 day ago? And should it be = 0 to achieve my objective?

        Thanks!

        Comment

        • Semiadmin
          Senior Member
          • Oct 2014
          • 1625

          #5
          Originally posted by norbhinn
          Q: Why did you put >= 0 in the last statement?
          It's a fake condition, and it is always true. But this condition prevents the trigger from being fired prematurely.

          Comment

          • norbhinn
            Junior Member
            • Jun 2021
            • 3

            #6
            Aha, ok, thanks! Its working great now.

            Comment

            • Markku
              Senior Member
              Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
              • Sep 2018
              • 1782

              #7
              Originally posted by Semiadmin
              It's a fake condition, and it is always true. But this condition prevents the trigger from being fired prematurely.
              I think I'm learning here now... So the idea of last(/template/key[{#SNMPVALUE}],#1:now-1d) >= 0 is that if there is no data for the value 24h ago (as required by the expression), the last() function evaluates to *undefined* (or something like that, ie. not ">= 0") and the trigger does not trigger?

              Markku

              Comment


              • Semiadmin
                Semiadmin commented
                Editing a comment
                yes, the trigger goes to the state "Unknown"
            Working...