Ad Widget

Collapse

Trigger expression for last 3 changes in a row are with some value

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • reddysk
    Junior Member
    • Jan 2024
    • 8

    #1

    Trigger expression for last 3 changes in a row are with some value

    Hello,

    I am trying to setup a trigger wich will raise problem in case if last 3 measures report increase of value at least by 4.

    Something with this syntax but functional.
    "last(change(rejected.sessions),#3)>=4".

    Meaning last 3 values of function "change(rejected.sessions)" are higher or equal 4

    Can't find the right solution.

    Thank your
    Regards, Rudo
  • Answer selected by reddysk at 18-03-2024, 10:42.
    markfree
    Senior Member
    • Apr 2019
    • 868

    I think the expression "last(change(rejected.sessions),#3)" would be incorrect.

    The "change" function gives you "the amount of difference between the previous and latest value."

    You cannot evaluate the second or third most recent change amount unless you store it.
    Therefore, "change(rejected.sessions)" should be an item for the "last" function to evaluate it.

    Still, you could try to use only the "last" function for this.

    Is this what you mean?
    Code:
    ( last(/host/key,#1) - last(/host/key,#2) )>=4
    and
    ( last(/host/key,#2) - last(/host/key,#3) )>=4
    and
    ( last(/host/key,#3) - last(/host/key,#4) )>=4

    Comment


    • reddysk
      reddysk commented
      Editing a comment
      Mark, thank you. it is working by this hack.
  • markfree
    Senior Member
    • Apr 2019
    • 868

    #2
    I think the expression "last(change(rejected.sessions),#3)" would be incorrect.

    The "change" function gives you "the amount of difference between the previous and latest value."

    You cannot evaluate the second or third most recent change amount unless you store it.
    Therefore, "change(rejected.sessions)" should be an item for the "last" function to evaluate it.

    Still, you could try to use only the "last" function for this.

    Is this what you mean?
    Code:
    ( last(/host/key,#1) - last(/host/key,#2) )>=4
    and
    ( last(/host/key,#2) - last(/host/key,#3) )>=4
    and
    ( last(/host/key,#3) - last(/host/key,#4) )>=4

    Comment


    • reddysk
      reddysk commented
      Editing a comment
      Mark, thank you. it is working by this hack.
  • Semiadmin
    Senior Member
    • Oct 2014
    • 1625

    #3
    This method is simple for 3 values, but dramatically difficult for many values (for example, 60 or during 1h).
    For such case you may create a dependent item (for example, rejected.sessions.delta) with simple change in preprocessing and a trigger:

    monoinc(/host/rejected.sessions,1h)=1 and min(/host/rejected.sessions.delta,1h)>=4
    Last edited by Semiadmin; 22-02-2024, 10:01.

    Comment

    • markfree
      Senior Member
      • Apr 2019
      • 868

      #4
      Originally posted by Semiadmin
      This method is simple for 3 values, but dramatically difficult for many values (for example, 60 or during 1h).
      For such case you may create a dependent item (for example, rejected.sessions.delta) with simple change in preprocessing and a trigger:
      monoinc(/host/rejected.sessions,1h)=1 and min(/host/rejected.sessions.delta,1h)>=4
      Considering the question above was only for the last 3 deltas, I think that using the "last" is sufficient and avoids creating a new item. But I see what you mean for a larger context.

      I didn't understand one thing: why use the "monoinc" function for the parent item?
      If a dependent item is created to store the delta values, isn't the "min" function enough?
      Last edited by markfree; 23-02-2024, 02:46.

      Comment

      • Semiadmin
        Senior Member
        • Oct 2014
        • 1625

        #5
        If the value of the master item is reduced, the dependent item will skip the value. We have to make sure that this does not happen.

        Comment


        • markfree
          markfree commented
          Editing a comment
          Oh I see... because Zabbix discards negative differences with the simple change preproc.
      Working...