[rrd-users] Summarize minute values into hourly values

JoeSpam8 JoeSpam8 at gmail.com
Fri Feb 18 18:45:36 CET 2011


I am monitoring my power meter in my house and it is good fun to track the
usage. I have create a RRD database in where I put the amount of watts used
the last minute - this could be everything from 20 to 60 watt per minute (I
am not too happy to see 60 watts used per minute - what a bill I get!). The
variable is defined as a GAUGE in the database.

I am creating the database like this:

rrdtool create power.rrd \
  --start N \
  --step 60 \
  DS:tpower:GAUGE:120:U:U \
  RRA:AVERAGE:0.5:1:2880 \
  RRA:AVERAGE:0.5:5:2016 \
  RRA:AVERAGE:0.5:30:2976 \
  RRA:AVERAGE:0.5:60:4320

And then I am updating the database every minute with a new integer number -
so far so good.

I can easily print out a nice graph viewing the raw data where I can see the
watt usage per minute.

But... I would also really like to see a summarized "kW/h" value for the
last hour, in the same graph (on the other Y-axis) so I can keep track on
both values in the same time but I really can't seem to get my head to
understand how to do this?

I am creating my current graph like this:

rrdtool graph power_1hour.png \
  --start -3600 \
  --width 600 \
  --height 400 \
  --x-grid MINUTE:1:MINUTE:5:MINUTE:5:0:%H\:%M \
  --y-grid 1:2 \
  --right-axis-label "Watt" \
  --right-axis 1000:0 \
  --units-length 3 \
  --title "Last 60 minutes (1 minut interval)" \
  --vertical-label "Watt" \
  DEF:tpower1=power.rrd:tpower:LAST \
  VDEF:tpower1-min=tpower1,MINIMUM \
  VDEF:tpower1-avg=tpower1,AVERAGE \
  VDEF:tpower1-max=tpower1,MAXIMUM \
  VDEF:tpower1-last=tpower1,LAST \
  COMMENT:" \l" \
  COMMENT:"                       Current" \
  COMMENT:"      Minimum" \
  COMMENT:"    Averafe" \
  COMMENT:"      Maximum\l" \
  LINE3:tpower1#1E90FF:"Minute usage" \
  GPRINT:tpower1-last:"%7.0lf%Swatt" \
  GPRINT:tpower1-min:"%8.0lf%Swatt" \
  GPRINT:tpower1-avg:"%9.0lf%Swatt" \
  GPRINT:tpower1-max:"%9.0lf%Swatt\l" \
  COMMENT:" \l" \
  COMMENT:"Graph updated at `date +\"%Y-%m-%d %H\:%M\"`\l"

I have started on the second Y-axis but it is wrong. Also note that I have
just translated it so the spacing is wrong.

Any help is really appreciated.
-- 
View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/Summarize-minute-values-into-hourly-values-tp6040864p6040864.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.



More information about the rrd-users mailing list