Ad Widget

Collapse

Zabbix trigger - Checking every value of last X seconds or #number

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mtjzb
    Junior Member
    • Jun 2018
    • 6

    #1

    Zabbix trigger - Checking every value of last X seconds or #number

    Hi --

    I need a trigger which checks to see if every stored value during the last Y seconds (or #num of collected values), has been equal to (or greater/less than) X. I've always thought "last" should work this way... but... it doesn't avg, min, and max doesn't work for me. Here's an example of what I'm looking for:
    I'm using "most-recent" as the magical function I want that doesn't exist.
    What is the alternative way of doing this?

    Code:
    {[URL="https://admin1.xprepls.com/zabbix/items.php?form=update&itemid=25440"]Template_Linux:net.tcp.service[ssh][/URL].[B]most-recent(300[/B][B])[/B]}=0
    {[URL="https://admin1.xprepls.com/zabbix/items.php?form=update&itemid=25440"]Template_Linux:net.tcp.service[ssh][/URL].[B]most-recent(#5[/B][B])[/B]}=0

  • kernbug
    Senior Member
    • Feb 2013
    • 330

    #2
    Originally posted by mtjzb
    Hi --

    I need a trigger which checks to see if every stored value during the last Y seconds (or #num of collected values), has been equal to (or greater/less than) X. I've always thought "last" should work this way... but... it doesn't avg, min, and max doesn't work for me. Here's an example of what I'm looking for:
    I'm using "most-recent" as the magical function I want that doesn't exist.
    What is the alternative way of doing this?

    Code:
    {[URL="https://admin1.xprepls.com/zabbix/items.php?form=update&itemid=25440"]Template_Linux:net.tcp.service[ssh][/URL].[B]most-recent(300[/B][B])[/B]}=0
    {[URL="https://admin1.xprepls.com/zabbix/items.php?form=update&itemid=25440"]Template_Linux:net.tcp.service[ssh][/URL].[B]most-recent(#5[/B][B])[/B]}=0
    Hm, always thought that last(#1) is the most recent value.
    Last edited by kernbug; 14-06-2018, 11:24.

    Comment

    • mtjzb
      Junior Member
      • Jun 2018
      • 6

      #3
      Originally posted by kernbug

      Hm, always thought that last(#1) is the most recent value.
      It is, but I'm looking for the last X values (or seconds).

      For example, using my example from above:
      Code:
      {Template_Linux:net.tcp.service[ssh].most-recent(#5)}=0
      if I have the following values stored, here are the results I want to see:
      0,0,0,0,0 = True (because all 5 stored values match 0)
      0,1,0,1,0 = False (because not all of the 5 most recent stored values are 0)

      Years ago the documentation was ambiguous (or wrong) about what the "last" function did, and I thought that if I used last(300) or last(#5) it would accomplish my goal, but it didn't, and the documentation is much more clear now.

      Comment

      • kernbug
        Senior Member
        • Feb 2013
        • 330

        #4
        Originally posted by mtjzb
        0,0,0,0,0 = True (because all 5 stored values match 0)
        0,1,0,1,0 = False (because not all of the 5 most recent stored values are 0)
        It's a trigger expression logic in that case.

        Comment

        • mtjzb
          Junior Member
          • Jun 2018
          • 6

          #5
          Originally posted by kernbug

          It's a trigger expression logic in that case.
          Sorry, not quite sure what you're saying. Are you saying there is existing logic that would do that? Can you point me in the right direction?

          I'm hoping your suggestion is not overly complex, because I plan on using a lot of these.

          Thanks for your help!

          Comment

          • Linwood
            Senior Member
            • Dec 2013
            • 398

            #6
            I'm not sure why min and max don't work, something like min(#5)=3 and max(#5)=3 tests basically that all the last five items are exactly 3. Conversely min(#5)>3 and max(#5)<8 makes sure that the values are in the range 4 thru 7. There are other functions that can do similar, but can you elaborate why min/max do not work?

            Comment

            • kernbug
              Senior Member
              • Feb 2013
              • 330

              #7
              Originally posted by mtjzb

              Sorry, not quite sure what you're saying. Are you saying there is existing logic that would do that? Can you point me in the right direction?
              More about trigger expression with examples: https://www.zabbix.com/documentation...ers/expression

              Comment

              Working...