# [rrd-users] Re: TOTAL gives different values on different graph widths

Alex van den Bogaerdt alex at ergens.op.het.net
Wed Oct 5 17:53:27 MEST 2005

```On Wed, Oct 05, 2005 at 05:23:37PM +0200, Erik Bernhardsson wrote:

> Anyway, I wanted to calculate the sum of a value using TOTAL and this
> command seemed to work:
>
> [snip] --end now --start end-86400s --width 10000 [snip]

> But when I rerun it with another graph width I get another value:
>
> [snip] --end now --start end-86400s --width 1000 [snip]

> I'm guessing that it is because unknown values are being thrown away
> when calculating TOTAL on consolidated values but is that really the
> wanted behaviour?

There's more:
-  "now" isn't a constant
-  the amount of time per interval isn't a constant
-  the amount of time per 1000 or 10000 intervals isn't the same
(because rrdtool _needs_ whole intervals to work with, it will
shift your start and end times around)

Make sure you work with whole boundaries; when expressing time as
a number since 1970-01-01T00:00Z (the unix epoch) it needs to be
a whole multiple of (your step time, multiplied by the number of
PDPs per CDP, multiplied by the number of CDPs per pixel row).

86400 seconds is 288 rows of 300 seconds.  If your step size is 300
and if you have an RRA with 1 PDP per CDP, try "--width 288" (or any
multiple).  If your step size is 60 seconds, try 1440, and so on.

If you use smaller widths, data reducing takes place before TOTAL
has a chance to sum it up.  This may change in the future but for
now it is as it is.

Example for 60 seconds and width 720: RRDtool needs to combine two
CDPs to display on one pixel column.  It will make sure that both
start and end time of each column is a multiple of 600.  Therefore
if you compare "--width 720" against "--width 1440" it probably
won't result in the same.

If you look at data series too long to fit in one image, it is best
to have an RRA do most of the work.  Example for step size == 60:
have an RRA that combines 60 PDPs into one CDP (one hour per interval)
and make sure all times specified are a whole multiple of 3600. You
can then specify "--width 168" (or any whole multiple) to look at
a week.

--
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users