[rrd-users] NAN and 0 in aggregate graphs

Adam Jacob Muller rrdtool-users at adam.gs
Mon Mar 31 04:00:52 CEST 2008


Hello,
I have an application utilizing rrdtool where it is in some cases  
useful to produce "aggregate" graphs of information, this works great  
in rrdtool by just doing a CDEF=somefield_aggregate=field1,field2,+

the only problem I experience here is when field1 or field2 are NAN,  
obviously when field1 and field2 are NAN the proper result is NAN, but  
if field1 is NAN and field2 is some positive value than the result  
should be field2's value.

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

Any ideas how to do this.


-Adam



More information about the rrd-users mailing list