[rrd-developers] data -> Nan conversion in reduce_data()

James Kingston james.kingston at gmail.com
Tue Nov 9 01:51:12 MET 2004

This is an update to a plea I sent to the users list last week.

Background... we use the 2nd variable of a certain poller to ascertain
the availability of the poll.  If the poll was successful, we write
100.  If it wasn't, we either write 0 or nothing at all (NaN),
depending on how the poller failed.  We use the RRDs::graph function
to query the availability of the poller using the following CDEF,
whose purpose is to convert NaNs to zeros: CDEF:B1=B0,UN,0,B0,IF

What we have been noticing is that for certain time ranges that
contain all 100s (verified by RRDs:fetch), we frequently get a number
between 98 and 100.

After a lot of digging I discovered that the NaNs were being
introduced into the data by the reduce_data function, lines 541 and
616 of rrd_graph.c.  It was changing the 2nd and last samples (which
contained valid data) to NaNs.  Commenting out the two lines gives us
the results that we would expect.

My question is, what is the purpose of these lines, and what possible
repercussions might there be for removing them?

    /* Depending on the amount of extra data needed at the
    ** start of the destination, three things can happen:
    ** -1- start_offset == 0:  skip the extra source row
    ** -2- start_offset == cur_step: do nothing
    ** -3- start_offset > cur_step: skip some source rows and 
    **                      fill one destination row with NaN
    if (start_offset==0) {
    } else if (start_offset!=cur_step) {
	srcptr += ((*ds_cnt)*skiprows);
        for (col=0;col<(*ds_cnt);col++) *dstptr++=DNAN; 

... and ...

    /* If we had to alter the endtime, we didn't have enough
    ** source rows to fill the last row. Fill it with NaN.
     if (end_offset!=0) for (col=0;col<(*ds_cnt);col++) *dstptr++ = DNAN; 

Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the rrd-developers mailing list