[rrd-users] print a variable in the COMMENT field?
Alex van den Bogaerdt
alex at ergens.op.het.net
Wed Feb 20 18:56:47 CET 2008
On Wed, Feb 20, 2008 at 08:36:00AM -0700, Matthew Tice wrote:
> Hello, I'm wondering if it is possible to print a variable in the COMMENT:
> field. I have a setup like this:
> TITLE Freezer Temperature
> YAXIS Degrees Kelvin
> DEF:tl=freezer.rrd:freezerf:AVERAGE
> CDEF:k2c=tl,273.15,-
> AREA:tl#@COLOR@:Temperature
> COMMENT:\n
> GPRINT:tl:LAST:Temperature\: %2.1lf (cur)
> GPRINT:tl:MAX:\: %2.1lf (max)
> GPRINT:tl:MIN:\: %2.1lf (min)
> GPRINT:tl:AVERAGE:\: %2.1lf (avg)\n
>
>
> I'd like to take that variable k2c and print it's value on the COMMENT
> line. Is this at all possible?
k2c is not really a variable, it is more like an array of variables.
You would need a print statement (such as those for tl) anyway.
And now the answer: yes, it is possible, but not from rrdtool itself.
Consider:
DEF:tl=freezer.rrd:freezerf:AVERAGE
CDEF:k2c=tl,273.15,-
PRINT:k2c:AVERAGE:%2.1lf
called from a script. This script catches the output, into a
variable, and uses that in the next RRDtool command:
DEF:tl=freezer.rrd:freezerf:AVERAGE
CDEF:k2c=tl,273.15,-
AREA:tl#@COLOR@:Temperature
COMMENT:${YOURVARGOESHERE}\n
GPRINT:tl:LAST:Temperature\: %2.1lf (cur)
GPRINT:tl:MAX:\: %2.1lf (max)
GPRINT:tl:MIN:\: %2.1lf (min)
GPRINT:tl:AVERAGE:\: %2.1lf (avg)\n
If this means it is possible _for_you_ in _your_ setup, I cannot tell.
But it is possible.
--
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/
More information about the rrd-users
mailing list