Ad Widget

Collapse

Calculated items with last() function if there's no data from referenced items

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • johndoe2374
    Member
    • Aug 2021
    • 80

    #1

    Calculated items with last() function if there's no data from referenced items

    Hello everyone.

    I want to know whether it's possible to not calculate an item using last() function if there's no data from referenced items.

    Example: I've created 2 item prototypes for "Interfaces SNMP" template - one of them gets ISP's bandwidth limitation from network interface comment (like "WAN - Speed: 200"), another one - calculated item, which returns utilization of that limit in percentage (for incoming traffic). Formula is:
    Code:
    last(//net.if.in[ifHCInOctets.{#SNMPINDEX}])/last(//net.if.providerspeed[ifAlias.{#SNMPINDEX}])*100
    So, the problem is when your router will go down, this item will still be calculated, which will affect aggregation numbers in long term if you want to get an average utilization for 6 months or so. Same thing happens with "Memory utilization" and "Free swap space" items from default "Windows by Zabbix agent" templates - it keeps calculate an item using last values which were received just before the host went down.

    Probably the way around is to use some other function instead of last() like avg() with the period equal to referenced items polling interval, but it doesn't seem to be an elegant solution.
  • johndoe2374
    Member
    • Aug 2021
    • 80

    #2
    Post bump.

    Comment

    • Semiadmin
      Senior Member
      • Oct 2014
      • 1625

      #3
      For example:
      Code:
      last(//net.if.in[ifHCInOctets.{#SNMPINDEX}]) / last(//net.if.providerspeed[ifAlias.{#SNMPINDEX}]) * 100 / count(//net.if.in[ifHCInOctets.{#SNMPINDEX}],1m)
      if update interval is equal 1m.
      In preprocessing: Check for not supported value, Discard value

      Comment

      • johndoe2374
        Member
        • Aug 2021
        • 80

        #4
        Wow, I didn't think about checking values count. Great workaround, thank you!

        Comment

        Working...