[rrd-developers] rrd fetch -e NOW problem

Thorsten von Eicken tve-rrd at voneicken.com
Thu Apr 25 20:38:48 MEST 2002


I've been having problems with rrd fetch not returning info from the IMHO 
highest resolution RRA. I think I just tracked-down the problem. Here's 
what happens.

Say you have and RRD with:
    step = 60
    rra[0].pdp_per_row = 450
    rra[1].pdp_per_row = 1440
and now you ask to fetch from some start that is after the start of both 
RRAs, and to end = NOW (i.e. the default ending time). Suppose 
NOW=1019702095 (some time April 24th 2002).

Rrd fetch will now try to find the RRDs that cover the largest portion of 
the requested interval, and then among those equal in that criterion, it 
will find the one with the best resolution. (See rrd_fetch.c for details.) 
Usually, in the scenario above, both RRAs will provide equal coverage 
because they both start before the requested time period and both end 
"now". So the second step should return the RRA with the finer granularity.

But this not always the case: the real end time of the two RRAs may 
actually not be the same. Rrd fetch calculates the last stored sample, 
which falls on a multiple of step*pdp_per_row as follows:
   end(rra[i]) = last_upd - (last_upd % (step * rra[i].pdp_per_row))
If the RRD has been fed properly, last_upd = now - (now % step)

If you plug in the numbers from my example you will get:
    last_upd = 1019702040
    end(rra[0]) = 1019682000
    end(rra[1]) = 1019692800
And whoops, the coarser RRA has a data point later than the finer one 
because of the way the strides interleave. So rrd fetch determines that the 
coarser RRA covers more of the desired interval than the finer one and 
returns that one. Strictly speaking, this is correct, but it's unlikely to 
be what one had in mind. In my case, the monthly graph was drawn using the 
RRA designed for the yearly graph, resulting in pretty abysmal resolution.

The upshot is that using -e NOW may not give you what you expect unless the 
pdp_per_row of all the RRAs are multiples of one another.

Happy RRDtooling,
         Thorsten


-----------------------------------------------------------------
Thorsten von Eicken
Expertcity, Inc.                            Phone: (805) 690-6445
5385 Hollister Ave #111                     Fax:   (805) 964-6103
Santa Barbara, CA 93111                     Cell:  (805) 698-5666


--
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