[rrd-users] NAN and 0 in aggregate graphs

Simon Hobson linux at thehobsons.co.uk
Mon Mar 31 16:07:54 CEST 2008


Adam Jacob Muller wrote:

>Right now I am solving this by doing something like:
>
>CDEF:field1_nz=%s,UN,0,field1,IF
>CDEF:field2_nz=%s,UN,0,field2,IF
>CDEF:field_total=field1_nz,field2_nz,+
>
>this works, but, on values where both are NAN this returns 0, it would
>be much more preferable to return NAN here


Hmm, looking at the doc pages it doesn't look like boolean operators 
(AND, OR) are provided, if they were then I would suggest something 
like :
CDEF:field1_nz=%s,UN,0,field1,IF
CDEF:field2_nz=%s,UN,0,field2,IF
CDEF:field_total=field1_nz,field2_nz,+

CDEF:final_value=field1,UN,field2,UN,AND,field_total,UNKN,IF


This is a bit contrived, but how about :

CDEF:a=field1,UN,field2,0,IF
ie IF filed1 is unknown, set a=field2, else set a=0

CDEF:final_total=a,UN,UNKN,field_total,IF
ie, if a is unknown (means both field1 and field2 must be unknown), 
then set final_value to unknown, else use total calculated.



More information about the rrd-users mailing list