[rrd-users] Question with 1-hour samples

Jason iknowjason at pobox.com
Thu Jan 20 17:13:10 CET 2011

On 01/20/2011 09:25 AM, Simon Hobson wrote:

OK, in short, lets assume you keep stuffing values in at least as
often as your step size.

Firstly, RRD will normalise your data to get a SINGLE value for each
STEP period. So, for example and assuming 5 minute (300s) step size,
you will get a SINGLE value for the period 03:05 to 03:10. This is
called a Primary Data Point (PDP). It does not matter if you feed in
a new value every second - you only get ONE PDP for each STEP period.
Min, Max, Average have no bearing at all on this as there is only
ever a single value for the step.

Next, every so often you will complete the number of steps required
to fill a consolidated data point. If, for example, you consolidate
12 PDPs into a Consolidated Data Point (CDP) - this will happen on
the hour since all time calculations are referenced to Unix epoch
(Midnight, 1st Jan 1970 UTC).
So, you keep stuffing in updates, and come 04:00 RRD will take the 12
PDPs covering 03:00 to 04:00 and consolidate them.
For an AVERAGE consolidation, it will take the average. For a
MAXMIMUM consolidation it will take the maximum, and for a MINIMUM
consolidation it takes the minimum. Note that in all cases, these are
not calculated from the values you put in, but from the normalised
values stored in the PDPs.

Ok, I have read about the concept behind PDP and CDPs, and thought I
understood exactly how to use them.  Your explanation confirms that I
think I'm on the right track.

So for the following data example:

Let's say that I have created a brand new *.rrd and collected data for
the first three hours using the 300 second step period, with 12 steps
filling one CDP.  The PDPs are filled into CDPs in the following way:

PDP 1 values for first hour sampling:
(10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20)
CDP 1 AVERAGE consolidation:  15

PDP 2 values for second hour sampling:
(20, 20, 20, 20, 20, 20, 30, 30, 30, 30, 30, 30)
CDP 2 AVERAGE consolidation:  25

PDP 3 values for third hour sampling:
(10, 10, 10, 10, 10, 10, 30, 30, 30, 30, 30, 30)
CDP 3 AVERAGE consolidation:  20

Firstly, is this not correct?

Next question:
Let's say there are two RRDs for my Data Source - the first one is to
hold 14 days (336 rows) of CDPs and the second one holds 60 days (1440
rows) of CDPs.

When I graph the AVERAGE of these first three CDPs into two separate
graphs (14 versus 60 day 1-hour average), shouldn't both of them show a
maximum CDP of 25?  My two graphs don't show this - they are different.
 In addition, when I GPRINT the maximum value, they are not the same
either.  The 60 day is about 1/3 of the 14 day, for some reason.  For
the first three hours, the MAXIMUM of the averages should be the same
between 14 and 60 day.  Right?

This is how I am doing the graphing:

GPRINT:alerthouravg:MAX:Maximum alerts per hour\\:  %6.2lf
AREA:alerthouravg#1E90FF:Average per Hour

More information about the rrd-users mailing list