[rrd-users] Calculating AVG, treating UNKNOWNs as zero

Simon Hobson linux at thehobsons.co.uk
Mon Jul 30 22:08:08 CEST 2012

Derek Haynes wrote:
>The AVG consolidation function excludes UNKNOWN values. Instead of
>excluding them, I'd like to convert each UNKNOWN value to zero and
>then generate the average.

use a CDEF like b=a,UNKN,0,a,IF

If I've got the syntax right (you'd best check !), that means :
Compare a with unknown and leave a boolean on the stack.
If the boolean is true (a is unknown) then select 0, else select a.

Then average b

Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.

More information about the rrd-users mailing list