Ad Widget

Collapse

Calculated Item in Interface Discovery

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Behemoth
    Junior Member
    • Jun 2015
    • 5

    #1

    Calculated Item in Interface Discovery

    Hi,

    I’m trying to create a calculated item from values in interface discovery, but I haven’t really figured out how yet. I think the documentation is pretty clear, but somehow it isn’t working in my system. I’m running Zabbix 2.4.8.

    So, I need to see incoming packets per second (pps) on all interfaces on a router. I have collected three values from my interface discovery rules: ifHCInBroadcastPkts, ifHCInMulticastPkts and ifHCInUcastPkts. These are working fine and I get data from each one. In order to get pps, I need to combine these into a new item.

    So I created an Item Prototype in my discovery rules like this:

    Name: {#SNMPVALUE} - ifHCInPkts
    Type: Calculated
    Key: ifHCInPkts.[{#SNMPINDEX}]

    and I’ve tried these four exact formulas:

    Formula:

    Code:
    last(”ifHCInBroadcastPkts.[{#SNMPVALUE}]”)+last(”ifHCInMulticastPkts.[{#SNMPVALUE}]”)+last(”ifHCInUcastPkts.[{#SNMPVALUE}]”)
    Code:
    last(”ifHCInBroadcastPkts[{#SNMPVALUE}]”)+last(”ifHCInMulticastPkts[{#SNMPVALUE}]”)+last(”ifHCInUcastPkts[{#SNMPVALUE}]”)
    Code:
    last(”ifHCInBroadcastPkts.[{#SNMPINDEX}]”)+last(”ifHCInMulticastPkts.[{#SNMPINDEX}]”)+last(”ifHCInUcastPkts.[{#SNMPINDEX}]”)
    Code:
    last(”ifHCInBroadcastPkts[{#SNMPINDEX}]”)+last(”ifHCInMulticastPkts[{#SNMPINDEX}]”)+last(”ifHCInUcastPkts[{#SNMPINDEX}]”)
    But the only thing I see is this error:

    Cannot evaluate function "last()": item ”router01:”ifHCInBroadcastPkts[{#SNMPINDEX}]”" does not exist

    What am I doing wrong?
  • batchenr
    Senior Member
    • Sep 2016
    • 440

    #2
    Originally posted by Behemoth
    Hi,

    I’m trying to create a calculated item from values in interface discovery, but I haven’t really figured out how yet. I think the documentation is pretty clear, but somehow it isn’t working in my system. I’m running Zabbix 2.4.8.

    So, I need to see incoming packets per second (pps) on all interfaces on a router. I have collected three values from my interface discovery rules: ifHCInBroadcastPkts, ifHCInMulticastPkts and ifHCInUcastPkts. These are working fine and I get data from each one. In order to get pps, I need to combine these into a new item.

    So I created an Item Prototype in my discovery rules like this:

    Name: {#SNMPVALUE} - ifHCInPkts
    Type: Calculated
    Key: ifHCInPkts.[{#SNMPINDEX}]

    and I’ve tried these four exact formulas:

    Formula:

    Code:
    last(”ifHCInBroadcastPkts.[{#SNMPVALUE}]”)+last(”ifHCInMulticastPkts.[{#SNMPVALUE}]”)+last(”ifHCInUcastPkts.[{#SNMPVALUE}]”)
    Code:
    last(”ifHCInBroadcastPkts[{#SNMPVALUE}]”)+last(”ifHCInMulticastPkts[{#SNMPVALUE}]”)+last(”ifHCInUcastPkts[{#SNMPVALUE}]”)
    Code:
    last(”ifHCInBroadcastPkts.[{#SNMPINDEX}]”)+last(”ifHCInMulticastPkts.[{#SNMPINDEX}]”)+last(”ifHCInUcastPkts.[{#SNMPINDEX}]”)
    Code:
    last(”ifHCInBroadcastPkts[{#SNMPINDEX}]”)+last(”ifHCInMulticastPkts[{#SNMPINDEX}]”)+last(”ifHCInUcastPkts[{#SNMPINDEX}]”)
    But the only thing I see is this error:

    Cannot evaluate function "last()": item ”router01:”ifHCInBroadcastPkts[{#SNMPINDEX}]”" does not exist

    What am I doing wrong?
    i might be worng but shouldnt it be like this : ?

    Code:
    (”ifHCInBroadcastPkts.[{#SNMPINDEX}].last()”) and (”ifHCInMulticastPkts.[{#SNMPINDEX}].last()”) and (”ifHCInUcastPkts.[{#SNMPINDEX}].last()”)

    Comment

    • Behemoth
      Junior Member
      • Jun 2015
      • 5

      #3
      I tried your suggestion but now I get the following error message:

      Invalid first parameter in function [last()].

      Comment

      • batchenr
        Senior Member
        • Sep 2016
        • 440

        #4
        Originally posted by Behemoth
        I tried your suggestion but now I get the following error message:

        Invalid first parameter in function [last()].
        see if helps :



        http://stackoverflow.com/questions/7...multiple-items

        Comment

        • glebs.ivanovskis
          Senior Member
          • Jul 2015
          • 237

          #5
          If you are trying to sum all discovered items into one, currently it is not possible without "manual labor" or API scripting.

          Comment

          • Behemoth
            Junior Member
            • Jun 2015
            • 5

            #6
            OK, thanks. What does "manual labor" mean?

            Comment

            • robert.s
              Junior Member
              • Nov 2021
              • 5

              #7
              I know this is resurrecting an old issue but I had the same issue and finally figured it out
              Code:
              sum(last_foreach(//ifHCInBroadcastPkts[*]))
              should get what you need. I am also putting this here for my own use when I search this again as I inevitably will.

              Comment

              Working...