[rrd-users] How to compute first pdp time?

Simon Hobson linux at thehobsons.co.uk
Fri Apr 11 16:39:01 CEST 2014


aleluya <huangyongjian at gridsum.com> wrote:

> I try with that step parameter value is 5:
> rrdtool create test.rrd -b 1397188169 -s 5  DS:mem:GAUGE:1000:0:2000
> RRA:AVERAGE:0.5:1:5
> rrdtool updatev test.rrd  1397188170:1
> 
> I got this output:
> [1397188170]RRA[AVERAGE][1]DS[mem] = NaN
> 
> You see, the time of first pdp is 1397188170, though I set the step value is
> 5, it is not 5 seconds after the begin time, but only second after the begin
> time.

I really struggled to understand what you are asking, and I'm still not sure. However, what I think you are getting at is that having done an update at some arbitrary time, you don't get back the timestamps you expect.

The reason is that *ALL* periods in RRD are an integer multiple of their length since unix epoch (Midnight, Jan1 1970 UTC). So for a step time of 5, all primary data points (PDPs will end on a multiple of 5 seconds. Thus your RRD cannot start at 1397188169 - only at 1397188165 or 1397188170 (integer multiples of 5).

Furthermore, once you consolidate, you cannot consolidate on arbitrary boundaries either - so say you consolidated 720 PDPs to get consolidated data points (CDPs) at 1 hour intervals, then these would always end on an integer multiple of 3600. And if you consolidate to 1 day samples then you'll have CDPs that end on an integer multiple of 86400 - ie midnight UTC.

For some good tutorials see http://www.vandenbogaerdt.nl/rrdtool/ "Rates, normalizing and consolidating" is usually a good one to start with.



More information about the rrd-users mailing list