Ad Widget

Collapse

calculated items

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rsokoll
    Junior Member
    • Jun 2018
    • 11

    #1

    calculated items

    Hi,

    I want to know how many incoming bytes have crossed my router's eth0 within the last 30 days.
    From my understanding, I need a calculated item that substracts the value of last(//net.if[eth0],30d) from last(//net.if[eth0]​​​​), but that raises a syntax error:

    Code:
    Incorrect value for field "Formula": invalid second parameter in function "last".
    My formula is

    Code:
    last(//net.if[eth0]) - last(//net.if[eth0],30d)
    What am I missing?
  • Brambo
    Senior Member
    • Jul 2023
    • 245

    #2
    I think you should have
    Code:
    sum(last(//net.if[eth0]) - last(//net.if[eth0],30d))

    Comment

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

      #3
      Originally posted by Brambo
      I think you should have
      Code:
      sum(last(//net.if[eth0]) - last(//net.if[eth0],30d))
      That is pretty useless ... as it is wrong from the start...

      you have to remember that "last" is kind of special needs kid.. you cannot use last(/host/item,1d) to refer to a value one day ago... last has only "#num (optional) - the Nth most recent value". no "seconds" option..
      so if you want to refer to a value X time ago, you need to use time shift (last (/host/key,<#num<:time shift>>)​)​ https://www.zabbix.com/documentation...ion#time-shift
      I think "last(//net.if[eth0]) - last(//net.if[eth0],#1:now-30d)" should work...

      Comment

      Working...