[rrd-users] print a variable in the COMMENT field?

Matthew Tice mjtice at gmail.com
Wed Feb 20 19:00:42 CET 2008


On Feb 20, 2008 10:56 AM, Alex van den Bogaerdt <alex at ergens.op.het.net>
wrote:

> 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.
>
> --


Okay, thanks Alex - that's what I was looking for.

Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20080220/db10ed71/attachment.html 


More information about the rrd-users mailing list