[rrd-users] Accumulative power usage graph
Alex van den Bogaerdt
alex at vandenbogaerdt.nl
Sat Feb 21 12:06:52 CET 2009
----- Original Message -----
From: "gm_sjo" <saqmaster at gmail.com>
To: <rrd-users at lists.oetiker.ch>
Sent: Saturday, February 21, 2009 10:39 AM
Subject: [rrd-users] Accumulative power usage graph
> Hi all,
> This is my first post to this list so let me know if anything is out
> of order. I'm a complete rrdtool noob so bear with me.
> I've got some power usage graphs knocked up, using a currentcost CC128
> as a data source, via a Perl script. It's working fine just displaying
> historic actual usage, as per this example :-
Looking good, albeit a bit high. If you think 500W is the true power
consumption, then OK. Else make sure you aren't confused between what you
think you are storing and what you are actually storing here. I'm talking
> Now, more importantly than the above graph I need to create a chart
> showing kWh used per day/month/quarter/year. I'm thinking that because
> I have a 1 day graph with an average consumption value I should be
> able to transpose this into a kwh used for that day.
And indeed you can. W=J/s and kWh is 3600000J. Just do the math.
Next question: can you use rrdtool to graph this the way you showed in the
> Something like this :-
> Problem is I have no idea how to achieve this - has anyone done this
> that could share their conf, or perhaps just some
The problem here is that you define a day as midnight local time to midnight
local time. This is not how RRDtool works. The problem is bigger when you
start talking about months and quarters.
Unless you are willing to look at more normalized intervals (midnight UTC to
midnight UTC, intervals of 30 days starting at well defined moments in time,
and so on) you cannot display more than one of such interval at a time.
What can you do:
1: store your data in intervals no larger than one hour, every day compute
the average for that day, store the average elsewhere (e.g. some SQL
database) and graph there. Once a year you will count one hour twice, once a
year you will skip an hour in your averages.
2: live with the fact that you can display intervals which have a start
timestamp and an end timestamp which are whole multiples of the interval.
Example: if the interval is 3600 (one hour) then you can display 10:00 to
11:00 and 11:00 to 12:00, you cannot display 09:30 to 10:30 and 10:30 to
Look at the unix time stamp, e.g. 1235214000 (11:00 UTC today) divided by
3600 has no remainder.
Last midnight for me was 1235170800, divided by 86400 does give a remainder
thus is not suitable.
Midnight for you, once daylight saving has started, has the same problem.
It works exactly the same for longer intervals, such as a "month" (30 days)
or a "quarter" (90 days).
More information about the rrd-users