Turning NaNs into Zeros

RRD files have a way of having a bunch of NaNs which can wreak havoc on your Agg charts.  Here’s some code I found that solves this:

DEF:input=arq.rrd:input0:AVERAGE
CDEF:in_values=input,UN,0,input,IF

It is the same as:
if (input == NaN) {
input = 0;
}
else {
input = input;
}

Comments are closed.