# [rrd-users] question for an "average counter" rrd

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Sat Feb 23 15:14:36 CET 2013

```> I habe a pellet oven with webinterface (austrian ETA). The webinterface
> works perfect. I can read and set most of the values.
>
> Two of the values are counter:
> - pelles in kg
> - working time in seconds
>
> I put the pellets in kg in a counter rrd. So I can see for instance
> pellets/day vs. outside temperature.

Internally RRDtool will compute and store the number of kilograms per
second.

> Now I am interested in the value of pellets per year. My imagination
> would be a gliding yearly average (every day the rrd will be updatet
> with the pellets of the last 365 days).

Don't update like this. Just keep updating the RRD as usual.
Then display 365 days in a graph of 365 pixels wide.

Each pixel column will show the average number of kilograms per second
during that day.

If you print the average of those 365 values in your graph, you have the
average number of kilograms per day measured over an entire year.

A year is 365 times 24 times 60 times 60 seconds. That is 31536000 seconds.
Just multiply the rate you already have in your RRD by 31536000, and then
compute the average. The outcome will be the number of kilograms during the
past 365 days, which is the sliding window you want.

One small problem is that for RRDtool a day starts and ends at midnight UTC,
which is close but not equal to your time. I don't think this should be
relevant, even if you would live at the other side of the globe.

The other small problem is that you count kilograms, not pellets. This you
could solve by another multiplication in your CDEF, number of pellets per
kilogram.

```

More information about the rrd-users mailing list