Announcement

Collapse
No announcement yet.

Read previous value in SNMP trigger

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Read previous value in SNMP trigger

    Hi guys! im newbie with zabbix and i have a little question..

    Now im getting interface speed of device via SNMP with an associated trigger that alerts me when value changes. At the moment all is good, but i need to show in trigger name/caption what value was before change.

    For example, if interface speed changes, im get an alarm that says "Ethernet speed of interface was changed to XXX Mbps"
    I want know how can i show previous value before the trigger acts, for example "Ethernet speed of interface was changed from 1Gbps to 100 Mbps"

    This is my trigger configuration:
    Name: Ethernet speed of interface was changed to ({ITEM.LASTVALUE})
    Expression: {templateX:ethernetSpeed.diff()}=1

    Thanks!!

    #2
    Originally posted by fdavidcn View Post
    Hi guys! im newbie with zabbix and i have a little question..

    Now im getting interface speed of device via SNMP with an associated trigger that alerts me when value changes. At the moment all is good, but i need to show in trigger name/caption what value was before change.

    For example, if interface speed changes, im get an alarm that says "Ethernet speed of interface was changed to XXX Mbps"
    I want know how can i show previous value before the trigger acts, for example "Ethernet speed of interface was changed from 1Gbps to 100 Mbps"

    This is my trigger configuration:
    Name: Ethernet speed of interface was changed to ({ITEM.LASTVALUE})
    Expression: {templateX:ethernetSpeed.diff()}=1

    Thanks!!
    Hello

    As far as I know from here https://www.zabbix.com/documentation...ers/functions:
    Code:
    item.last(#2) - is the previous value
    
    item.prev() - is the previous value
    Example:
    Code:
    ({host:item.prev()} # {host:item.last()})
    Change {ITEM.LASTVALUE} to 1 and 2:
    Code:
    {ITEM.VALUE<1-9>}
    from here https://www.zabbix.com/documentation...ed_by_location

    Comment


      #3
      Hi kernbug, i was try to change values as you commented but i think that some config is wrong in my config because dont work as i need..

      Here is my Item monitor configuration:
      - Name: Ethernet Speed
      - Type: SNMPv2 Agent
      - Monitor: ethernetSpeed
      - SNMP OID: .1.3.6.1.2.1.31.1.1.1.15.1
      - SNMP Community: {$MYSNMP}
      - Information type: Numeric (Integer 64 bits)
      - Unit: bps
      - Refresh: 10s

      And this is Trigger configuration:
      - Name: Ethernet speed of interface was changed from {ITEM.VALUE1} to {ITEM.VALUE2}
      - Gravity: High
      - Expression: {netdevices.switches:ethernetSpeed.last()} <> {netdevices.switches:ethernetSpeed.prev()}=1


      I would apreciate any help!
      Thanks!

      Comment


        #4
        Originally posted by fdavidcn View Post
        Hi kernbug, i was try to change values as you commented but i think that some config is wrong in my config because dont work as i need..

        Here is my Item monitor configuration:
        - Name: Ethernet Speed
        - Type: SNMPv2 Agent
        - Monitor: ethernetSpeed
        - SNMP OID: .1.3.6.1.2.1.31.1.1.1.15.1
        - SNMP Community: {$MYSNMP}
        - Information type: Numeric (Integer 64 bits)
        - Unit: bps
        - Refresh: 10s

        And this is Trigger configuration:
        - Name: Ethernet speed of interface was changed from {ITEM.VALUE1} to {ITEM.VALUE2}
        - Gravity: High
        - Expression: {netdevices.switches:ethernetSpeed.last()} <> {netdevices.switches:ethernetSpeed.prev()}=1


        I would apreciate any help!
        Thanks!
        "Ethernet speed of interface was changed from {ITEM.VALUE1} to {ITEM.VALUE2}":
        Value1 is {netdevices.switches:ethernetSpeed.prev()}
        Value2 is {netdevices.switches:ethernetSpeed.last()}
        operator is "<>" between value1 and value2

        You don't need to compare with '=1'.

        Comment


          #5
          Hi again,

          I've tried your config but the result is "Ethernet speed of interface was changed from 1Gbps to 1Gbps. ITEM.VALUE1 and 2 have the same value??

          This is the trigger config:
          Name: Ethernet speed was changed from {ITEM.VALUE2} to {ITEM.VALUE1}
          Expression: {netdevices.switches:ethernetSpeed.last()} <> {netdevices.switches:ethernetSpeed.prev()}

          Thanks for your help!

          Comment


            #6
            Originally posted by fdavidcn View Post
            Hi again,

            I've tried your config but the result is "Ethernet speed of interface was changed from 1Gbps to 1Gbps. ITEM.VALUE1 and 2 have the same value??
            My mistake, as expected it does not work. I checked twice, one item -> one item.value/lastvalue result. Trigger function doesn't matter for item.value(((
            In other words you need second item with default port speed from the config of the SNMP device.
            Last edited by kernbug; 15-06-2018, 14:45.

            Comment


              #7
              Hi kernbug, this are history values at now
              1 2018-06-15 16:04:12 100000000 100 Mbps
              2 2018-06-15 16:04:02 1000000000 1 Gbps
              3 2018-06-15 16:03:52 1000000000 1 Gbps
              4 2018-06-15 16:03:42 1000000000 1 Gbps
              There is no way to compare ID 1 with ID 2 as following your previous config (item.value.prev() <> item.value.last())???

              In this example trigger should alert: "Ethernet speed was changed from 1 Gbps to 100 Mbps" and when recovers, trigger should alert "Ethernet speed was changed from 100 Mbps to 1 Gbps"

              I cant specify every port speed in templates because some devices are Fast Ethernet and others are Gigabit Ethernet. I would like some generic template

              Thanks!

              Comment


                #8
                Originally posted by fdavidcn View Post

                I cant specify every port speed in templates because some devices are Fast Ethernet and others are Gigabit Ethernet. I would like some generic template

                Thanks!
                Tested with item.diff()=1 and {item.value1} and {item.lastvalue1} in trigger name, very strange behavior. Check it on your setup.

                Comment


                  #9
                  Thanks for your help kernbug!

                  I will try this config later

                  Comment


                    #10
                    Hi kernbug, i was try your config without success

                    Always get the same value. I was try following functions without lucky:

                    avg
                    last
                    diff
                    prev

                    Thanks!

                    Comment


                      #11
                      Originally posted by fdavidcn View Post
                      Hi kernbug, i was try your config without success

                      Always get the same value. I was try following functions without lucky:

                      avg
                      last
                      diff
                      prev

                      Thanks!
                      Click image for larger version

Name:	Снимок экрана 2018-06-20 в 12.44.32.png
Views:	1
Size:	105.7 KB
ID:	360730

                      Comment

                      Working...
                      X