[rrd-users] wacked out numbers on simple Counter graph with Ubuntu
Alex van den Bogaerdt
alex at vandenbogaerdt.nl
Wed Nov 30 01:38:37 CET 2011
----- Original Message -----
From: "John Powell" <rrdtoolmail at jrp2.com>
To: <rrd-users at lists.oetiker.ch>
Sent: Wednesday, November 30, 2011 12:25 AM
Subject: [rrd-users] wacked out numbers on simple Counter graph with Ubuntu
> I am having really weird results with a counter. I am not a newbie to
> RRDtool, but have usually done gauges (and gauges are working just fine on
> the same server)
> My objective is very simple. I am trying to graph my electric usage. I am
> updating the meter reading (counter) every hour and trying to plot a simple
> 2 day graph. I am getting really small numbers (.000x) so they show up
> with the suffix "u" in the graph and effectively zero when I set 0-30 as
> the low/high. I am seeing usage of 1-2 KWh/hour when I look at the raw
[caveat: it's late, I'm tired, forgive me for any errors. Read the intent, not the literal text]
1000 Wh per hour is less than 1 Wh per second, if you want to show 'per hour' data then you will have to multiply by 3600 (source data, or CDEF at graph time).
> Here is my very simple create line. My intent for this basic example is to
> update every hour and save 24 hours.
> rrdtool create test.rrd --start 1322500000 --step=3600
> DS:kwH:COUNTER:7200:U:U RRA:AVERAGE:0.5:1:24
Heartbeat is set to 7200 which looks fine at a first glance. But what if you miss one update, and the one following it is one second late? I would choose something higher, e.g. 7300. Or something much lower, like 3700.
> rrdtool update test.rrd 1322530107:36469
> rrdtool update test.rrd 1322532117:36470
2010 seconds, a difference of 1, so 0.0004975 (rounded) per second. That's 0.4975m, or 497.5u
> rrdtool update test.rrd 1322535717:36472
3600 seconds, a difference of 2, that's about 0.00055556, or 555.56u
> The output of fetch:
> rrdtool fetch test.rrd AVERAGE
It may be better not to use kWh (it is not kwH). First of all, the 'k' means 'kilo', so you will get strange looking stuff like milikilowatthour. Also, the 'h' is 'times an hour', which then is used in combination with 'per second'.
A Wh is just an amount of Joules. 3600 of them, to be precise.
W = J/s.
Wh = 3600 J
kWh = 3600000 J
Why not enter the data as joules, and then, if so desired, present them as kWh ?
If your meter increased by 1, and if your meter shows how many kWh are used, then IMHO you should feed 3600000 to RRDtool. RRDtool has than Joules per second in its RRAs, which are the same as Watts, and you can easily convert those to kWh by using a CDEF (multiply by 3.6).
> 1322521200: -nan
> 1322524800: -nan
> 1322528400: -nan
> 1322532000: 4.9751243781e-04
> 1322535600: 5.5366915423e-04
Looks okay to me, because of normalization.
> And the graph created by this line:
> rrdtool graph dillon_temp_electriclast48hrs.
> png -t "Dillon Electric Usage - Last 2 Days" -v "KilowattHours" --start
> -1d --end now DEF:kw=test.rrd:kwH:AVERAGE LINE2:kw#000000
> is posted here:
Also is looking fine (at least at a first glance).
> Any thoughts or ideas appreciated. I am really hoping I did something dumb!
I won't judge that. I do hope I explained well enough why converting to joules may be a good idea.
More information about the rrd-users