[rrd-users] Modifying results for GPRINT output

Piers Kittel mailing at biased.org
Sat Sep 1 18:56:54 CEST 2007

Hello all,

I have just installed a bunch of sensor stuff my friend made for me  
to measure my electricity usage.  The sensor tells the computer when  
my electricity meter flashes, and a number in a text file is  
increased by one.  Every minute, the value is inserted in a RRD as a  
counter.  One flash from the meter represents 1/800th of a kW.  I  
modified my y axis to show the correct value - multiply by 1250 to  
give watts (I don't know why I have to multiply by a thousand to give  
watts, as if I multiply by 1.25, I can see a "m" in front of the  
values).  Anyway, I'd like to see the maximum, average and minimum  
values at the bottom of the graph - I've discovered GPRINT, but it  
shows the wrong value.  For the life of me, I can't figure out how to  
modify the values to show watts, instead of counts.  Currently, the  
graph shows a line going between 230 watts and 185 watts.  The output  
from GPRINT shows 0.18 for max, 0.17 for average and 0.15 for min.  I  
know I need to multiply those 3 values by 1250 to show the correct  
figures, but how?  I tried making a new variable and doing  
calculations on it, but doesn't seem to work.  The line in my script  
to create the graph is:

rrdtool graph -w 800 -h 250 --vertical-label "Watts" /home/piers/ 
software/rrdtool/leccyday.png DEF:usage=/home/piers/software/rrdtool/ 
meter.rrd:meter:MAX CDEF:realusage=usage,1250,\*   
LINE1:realusage#0000FF VDEF:usagemax=usage,MAXIMUM  
GPRINT:usagemax:"Max\: %lfw" > /dev/null

I tried inserting a snippet "CDEF:usagemax2=usagemax,1250,*" but  I  
got "ERROR: rpn expressions without DEF or CDEF variables are not  

What am I doing wrong here, and how do I fix this?

Thanks very much for your time!

Regards - Piers

More information about the rrd-users mailing list