Ad Widget

Collapse

Zabbix Trapper Macros

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zilla2000
    Junior Member
    • Mar 2015
    • 2

    #1

    Zabbix Trapper Macros

    I'm trying to create a calculated item that takes the current value of itemA and subtracts it from the last(365) of itemA. So basically, I need to find the difference between the current value of an item and its value a year ago. I see this in the docs:

    last("net.if.in[eth0,bytes]")+last("net.if.out[eth0,bytes]")


    I haven't found anything that will calculate between different values of the same item, is this possible?
  • ingus.vilnis
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2014
    • 908

    #2
    Hello and welcome to Zabbix forums!

    Here is the calculated formula that will return last value minus 365th value of itemA.
    Code:
    last("itemA")-last("itemA",#365)
    Make sure itemA is updated only once a day since function last(#365) will count 365 values back.

    Hope this helps!

    Best Regards,
    Ingus

    Comment

    • zilla2000
      Junior Member
      • Mar 2015
      • 2

      #3
      Thanks for the reply ingus.vilnis. I'm still having an issue though. It's in a "Not supported" status with the error of "Cannot evaluate function [last(#365)]." Here's what I'm trying:

      Type: calculated
      Key: annual_usage.["{#USER}"]
      Formula:

      last("system.run[cat /usr/local/bin/text.dat | egrep {#USER} |awk '{print $4}']", 0)-last("system.run[cat /usr/local/bin/text.dat | egrep {#USER} |awk '{print $4}']",#365)


      The individual item itself is working without issue. Do I need a custom user parameter key in order to make this work? I'm not sure if that's the issue or if it's a syntax issue. I'm pretty confident that there's at least 365 points of data collected though I'm not sure if there is a view where you can see the individual points.

      Comment

      Working...