[rrd-users] CDEF question

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Thu Dec 11 09:41:19 CET 2008


----- Original Message ----- 
From: "AlphaAlien" <maarten.sundman at plumasbank.com>
To: <rrd-users at lists.oetiker.ch>
Sent: Tuesday, December 09, 2008 12:59 AM
Subject: [rrd-users] CDEF question


>
> So I'm trying to make a totals column from 3 data variables in a graph, 
> but
> for some reason it's giving : ERROR: Cannot parse CF in 'GPRINT:total:%lf'
>
> If I remove the CDEF and the GPRINT for adding the 3 values it works fine.
> I'm kind of new to RPN but I believe I have the syntax proper

If you are using a recent version of RRDtool, GPRINT (and PRINT) comes in 
two different flavours:

a) with a CF
b) without a CF

When printing VDEF, you need flavour (b). There is nothing to consolidate 
(the C in CF), as a VDEF returns just one value.
When printing DEF or CDEF stuff, you need flavour (a). A CDEF returns a lot 
of values, which you need to consolidate for printing (AVERAGE, LAST, MIN, 
MAX).

In other words:
CDEFs use GPRINT:xyz:MAX:%6.2lf
VDEFs use GPRINT:abc:%6.2lf

If you only want to print e.g. maximums, then instead of:

DEF:v=....
VDEF:vmax=v,MAXIMUM
GPRINT:vmax:%6.2lf

you can do:

DEF:v=....
GPRINT:v:MAXIMUM:%6.2lf

But if you're using the e.g. maximums inside other CDEFs, you need a VDEF 
and then may as well use it for printing:

DEF:v=....
VDEF:vmax=v,MAXIMUM
[...]
CDEF:vdiff=....,vmax,...,*
[...]
GPRINT:vmax:%6.2lf



More information about the rrd-users mailing list