# [rrd-users] Re: Need help with RRA

Alex van den Bogaerdt alex at ergens.op.het.net
Tue Jun 8 23:30:59 MEST 2004

```On Tue, Jun 08, 2004 at 10:45:49AM -0700, Anuj Jain wrote:

> I am having a rrd like this
>
> rrdtool create test.rrd --start 1085640000 --step 300 \

300 seconds per PDP.

> DS:frm:GAUGE:600:0:65000 \
> DS:to:GAUGE:600:0:65000 \

> RRA:MAX:0.5:1:12    -> 12 samples for 1 hour

1 PDP per CDP.  12 CDPs.  12 * 300 seconds == 1 hour. Check.

> RRA:MAX:0.5:3:32    -> for 8hours

3 PDPs per CDP.  32 CDPs.  3*32*300 seconds = 28800 seconds = 8 hours. Check.

> RRA:MAX:0.5:6:48    ->for 1 day

6 PDPs per CDP. 48 CDPs.  6*48*300 = 86400. Check.

> The thing iw ant to know id that in 8 hour and in 1 day the 3 samples
> would the MAX of the 3 for the sum of those 3.

Now you've lost me...

> my requirement is the SUM of those 3 samples.

You want to know how much data has traveled in 8 hour, or in one day?

bytes = (bytes/second)*seconds, provided that seconds != 0.

You need a rate.  Use AVERAGE.  This rate is (bytes/second).  Now you
need to know the amount of seconds.  Easy, you are specifying that in
your graph command.  Since you know the right hand side of the formula,
you know the outcome.

rrdtool graph ....  --start end-8h ...  CDEF:total=rate,28800,* ...
or
rrdtool graph ....  --start end-1d ...  CDEF:total=rate,86400,* ...

followed by ... GPRINT:total:AVERAGE:"Total is %10.2lf bytes"

In both cases: make sure to set the end time on a whole multiple of your
CDP time duration.  "--end 1086733615" is wrong, "-e 1086739200" is OK.

1086739200 is an integer times 86400, 1086733615 is not.

HTH
Alex
--