# [rrd-users] rate per day graph from rate per hour DS

Alex van den Bogaerdt alex at ergens.op.het.net
Wed Jan 31 13:47:11 CET 2007

```On Tue, Jan 30, 2007 at 04:32:27PM -0500, Ben Griffith wrote:

> In fact, it isn't.  It shows 15/3600.

Ack. After thinking some more, this is logical.  You have 15 times
a counter increment.

> >I'm not sure what it does for "absolute".  For "counter" it saves
> >the value multiplied by time, and at the end (when the PDP is moved
> >into an RRA) dividing by total time results in a rate.

To clarify: this happens "out of sight"

> I think the only difference between absolute and counter is that absolute is
> assumed to be reset to 0 on every read.  So where a counter would read
> 1,3,7,7,9, an absolute would read 1,2,4,0,2.  In both cases, assuming all
> five values were collected in the same interval, the stored value would be
> 9/stepsize.

Correct.

[snip]
> That's the same as what you said, except for the "multiplied by time" part.

Internally, while the PDP is being prepared.  Once the PDP is ready
(your step size) the number is divided by time, to get a rate; this
rate is what you are seeing.

Internally:
(example using a step size of 1200)

300 seconds at 1 per second -> 300
301 seconds at 1 per second -> 301
299 seconds at 0 per second ->   0
300 seconds at 0 per second ->   0
----------------------------------  +
601

601 during 1200 seconds -> 0.008333333 per second for this PDP.

It is this 8.33333e-03 that you should see in the database.

> I tried this and have two step intervals collected now.  The first is a
> partial interval, since I started some minutes after 2pm.  The boiler was on
> for 22 minutes, according to the ABSOLUTE RRD.  The GAUGE RRD shows a value
> of 5.6943858168e-01, but that's probably telling me the percentage of time
> the boiler was on since collection started, partway through the interval.
> During the second inverval the boiler was on for only two minutes and the
> GAUGE shows 3.3333333333e-02, which is 2/60.  The step interval is still 1
> hour, and updates are still happening once per minute.  If I understand
> correctly, the result would still be the same (disregarding differences in
> accuracy due to sampling rate) no matter how frequently I update the gauge,
> unlike with the absolute.  In fact, does the sampling rate even need to be
> constant?

My suggestion was based partly because of my wrong assumption, and partly
because gauge is the correct data type for this scenario.

Everything in rrdtool is a rate.  If you enter "1" into a gauge, you are
effectively saying "during the last 'n' seconds, the burn rate was '1'."
In other words: the interval between the last update and the current one,
the burner was on.

The difference between gauge and absolute, in your case, is that gauge
updates the entire range (as long as heartbeat allows it) with a constant
rate, whereas the rate from absolute would depend on the time since last
update.

Let's look at different sampling intervals:

hh:00   previous update
hh:30   1

Rate for gauge:     1
Rate for absolute:  1/1800

hh:00   previous update
hh:15   1
hh:30   1

Rates for gauge:    1 and 1
Rates for absolute: 1/900 and 1/900
Total for gauge:    1  (same as previous example)
Total for absolute: 1/900  (differs from previous example)

You better test this in your experiments.  Perhaps I'm wrong again :)

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

```