Ad Widget

Collapse

avg doesn't work with only 1 item?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xxiii
    Junior Member
    • Jun 2013
    • 28

    #1

    avg doesn't work with only 1 item?

    I was trying to write a calculated item using the avg function, but it failed with this error:

    Cannot evaluate function [avg(5m)

    (Note that the error message omitted the data item being averaged, this is how the function actually appears in the formula: avg("ifOutOctets.1",5m)). After trial and error I discovered that since the item in question is only polled once every 5 minutes (currently) that average was failing because there was only 1 item in the 5 minute interval. Changing the function to last() solved the problem.

    However, I was using avg because I want to be able to change the polling interval (say to 150s or 100s) for the item in question, and not ignore the intermediate values in the calculated item.

    The calculated item doesn't need to be updated more often than every 5 minutes regardless of the update interval of the underlying data; so I set its update interval to 500 and figured I'd just grab the average of all the underlying data over that 5 minutes, but because of the above problem I couldn't get it to work (and will have to remember to update the calculated item when the underlying data item gets updated (to change last into avg or vs/versa)).

    It just occurred to me that perhaps by the the time calculated item got processed the underlying item was slightly more than 5 minutes old (although there should be a new one by then), so I tried changing the interval to 325s, but its still failing.
  • heaje
    Senior Member
    Zabbix Certified Specialist
    • Sep 2009
    • 325

    #2
    Instead of giving a timeframe to the avg function give it something like #2. That would give the average for the last two values regardless of how long ago they came in

    Comment

    • xxiii
      Junior Member
      • Jun 2013
      • 28

      #3
      The problem though is that I specifically need the average of values for a specific time period, regardless of how many values there are in that time period (and no values outside of that time period should be included).

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #4
        Originally posted by xxiii
        The problem though is that I specifically need the average of values for a specific time period, regardless of how many values there are in that time period (and no values outside of that time period should be included).
        How would you calculate an average of zero values?
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        Working...