[rrd-developers] Re: rrd fetch -e NOW problem

Alex van den Bogaerdt alex at slot.hollandcasino.nl
Fri Apr 26 00:39:49 MEST 2002

Thorsten von Eicken wrote:

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

interval in rra[0] =  450*60 = 27000
interval in rra[1] = 1440*60 = 86400

now                      = 1019702095
27000 * int(now / 27000) = 1019682000
86400 * int(now / 86400) = 1019692800

Last available interval in rra[0] is 1019682000-27000 to 1019682000
Last available interval in rra[1] is 1019692800-86400 to 1019692800

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

So, in rra[1] there is 10800 seconds worth of data more at the end.
Also depending on the start time, there may be more data available
in rra[1] than there is in rra[0].

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

1019702095 - 1019682000 = 20095
1019702095 - 1019692800 =  9295

They don't end "now", they end "now-20095" vs. "now-9295", the rest of
your request cannot be fulfilled.

As demonstated this does *not* provide equal coverage.

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

If you want to select a specific RRA, it is best to set the end time at
a whole multiple of 450*60 (in this case).  
You may have had in mind that you wanted the highest resolution rra,
another person may actually have had in mind to get the largest possible
dataset (as (s)he requested).

RRDtool is not a mind-reading program :)

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

I guess that one should say that using NOW may not give you what you
expect, period.

my 2c.

 / alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
| Technical questions sent directly to me will be nuked. Use the list. | 
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |

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