Ad Widget

Collapse

Unable to show current & previous values in event / trigger message

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • djmuk
    Junior Member
    • Dec 2017
    • 20

    #1

    Unable to show current & previous values in event / trigger message

    I want to monitor when a value changes (LTE Cell ID) and generate a message telling me what it was and what it is.
    So I create a trigger as :
    Code:
    last(/10.55.11.106/mtxrLTEModemEnbId.[2])<>last(/10.55.11.106/mtxrLTEModemEnbId.[2],#2)
    And then set the trigger name to be:
    Code:
    Roamed - Cell ID changed now {ITEM.VALUE1} was {ITEM.VALUE2},
    But it doesn't work... The message always shows the same value for both numbers.
    Code:
      Roamed Cell ID changed now 22074  was 22074
    What am I doing wrong? I thought the message text was static once it had been generated?

    Zabbix 6.2
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    As you are using same item twice then ITEM.VALUE1 and ITEM.VALUE2 refer to same item last value, not to 2 different values of same item...
    Last edited by cyber; 25-08-2022, 13:55.

    Comment

    • djmuk
      Junior Member
      • Dec 2017
      • 20

      #3
      According to the manual
      "Resolved to either:
      1) the historical (at-the-time-of-event) value of the Nth item in the trigger expression, if used in the context of trigger status change, for example, when displaying events or sending notifications."

      So isn't the 1st value in the trigger expression "last(/10.55.11.106/mtxrLTEModemEnbId.[2])"
      and the 2nd value "last(/10.55.11.106/mtxrLTEModemEnbId.[2],#2)"
      which must be different for the trigger to fire...

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #4
        if you are using 2 items, lets say A and B for calculation ... for sake of simplicity.... "A>B" Then ITEM.VALUE1 refers to first used items last value, ie "A", and ITEM.VALUE2 refers to second used items last value, "B". If you are using same item, comparing 2 values of same item "last(A) > prev(A)", then you will get last value of A for both ITEM.VALUE1 and ITEM.VALUE2.

        EDIT: so as docs say... it refers to "last value of the Nth item", not to "Nth value of the item"..
        Last edited by cyber; 25-08-2022, 15:19.

        Comment

        • djmuk
          Junior Member
          • Dec 2017
          • 20

          #5
          but I interpret "the Nth item in the trigger expression" as being the entire calculation - so the value of "last(/10.55.11.106/mtxrLTEModemEnbId.[2],#2)" - being the 2nd last (#2) value collected - NOT the value of "mtxrLTEModemEnbId.[2]"...

          so in your example I owuld expect itemvalue.1 to be Last(A) and item.value2 to be the value of prev(A)...

          Comment

          • djmuk
            Junior Member
            • Dec 2017
            • 20

            #6
            OK so I have now found the function.value<n> indexed macros so trying that syntax.

            Comment

            • dimir
              Zabbix developer
              • Apr 2011
              • 1080

              #7
              In trigger configuration form set the "Event name" to
              Code:
              Roamed - Cell ID changed now {?last(//mtxrLTEModemEnbId.[2])} was {?last(//mtxrLTEModemEnbId.[2],#2)}
              Last edited by dimir; 25-08-2022, 16:07.

              Comment

              • djmuk
                Junior Member
                • Dec 2017
                • 20

                #8
                dimir I tried something like that but got the syntax wrong (probably not enough {} pairs...) as it just showed me the code (in the event name field...) will give it another go.

                As you are a Dev - does item.value&lt;n&gt; refer to the entire expression (eg "last(/10.55.11.106/mtxrLTEModemEnbId.[2])") or does it just extract the collected value ("as cyber suggests?

                Comment

                • dimir
                  Zabbix developer
                  • Apr 2011
                  • 1080

                  #9
                  It refers to the last value of the item, no matter what the expression has (last or previous or last Nth).

                  Comment

                  • dimir
                    Zabbix developer
                    • Apr 2011
                    • 1080

                    #10
                    Check out this one: https://www.zabbix.com/documentation...ression_macros

                    Comment

                    Working...