Thanks Henrik, as usual your advice worked like a charm. I also changed
the GPRINT statements to use tempf so the legend would be correct.
Final version:
[temperature] FNPATTERN temperature.(.*).rrd TITLE Temperature YAXIS Fahrenheit DEF:p at RRDIDX@=@RRDFN@:temperature:AVERAGE CDEF:tempf at RRDIDX@=9,5,/,p at RRDIDX@,*,32,+ LINE2:tempf at RRDIDX@#@COLOR@:@RRDPARAM@ GPRINT:tempf at RRDIDX@:LAST: \: %5.1lf (cur) GPRINT:tempf at RRDIDX@:MAX: \: %5.1lf (max) GPRINT:tempf at RRDIDX@:MIN: \: %5.1lf (min) GPRINT:tempf at RRDIDX@:AVERAGE: \: %5.1lf (avg)\n
Thanks again! -Charles
Henrik Stoerner wrote:
On Tue, Feb 15, 2005 at 11:49:55AM -0700, Charles Jones wrote:
- How can I graph Farenheit instead of Celcius?
The easiest way of doing that is to change the hobbitgraph.cfg definition for the graph!
In the [temperature] section, there's this line that picks out the "temperature" setting from the RRD file:
DEF:p at RRDIDX@=@RRDFN@:temperature:AVERAGE
This is an RRDtool "DEF" (definition) that defines a variable "p at RRDIDX@" (the "@RRDIDX@" is handled by hobbitgraph, and is needed because there are multiple graphs. So essentially you get p0, p1, p2 etc - one for each temperature*rrd file).
There's also something called a "CDEF" - a Computed DEFinition. Meaning you can do math on the data you have in the RRD. So to compute Fahrenheit, you do the usual F = (9/5)*C + 32 - using Reverse Polish Notation (RPN) which is what CDEF's understand:
CDEF:tempf at RRDIDX@=9,5,/,p at RRDIDX@,*,32,+
Now you have two values: p at RRDIDX which is the original Celsius temperature, and tempf at RRDIDX@ which is the Fahrenheit equivalent. So to get the graph for the Fahrenheit one, change the LINE2 graph definition to use the Fahrenheit value:
LINE2:tempf at RRDIDX@#@COLOR@:@RRDPARAM@
Finally you just change the Y-axis label, and end up with this definition:
[temperature] FNPATTERN temperature.(.*).rrd TITLE Temperature YAXIS Fahrenheit DEF:p at RRDIDX@=@RRDFN@:temperature:AVERAGE CDEF:tempf at RRDIDX@=9,5,/,p at RRDIDX@,*,32,+ LINE2:tempf at RRDIDX@#@COLOR@:@RRDPARAM@ GPRINT:p at RRDIDX@:LAST: \: %5.1lf (cur) GPRINT:p at RRDIDX@:MAX: \: %5.1lf (max) GPRINT:p at RRDIDX@:MIN: \: %5.1lf (min) GPRINT:p at RRDIDX@:AVERAGE: \: %5.1lf (avg)\n
Untested, but you get the idea ... the RRDtool website has some more examples and tutorials on CDEF's.
Regards, Henrik
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe at hswn.dk