[rrd-users] Adding two VDEF values together

Steve Shipway s.shipway at auckland.ac.nz
Thu Feb 21 22:27:55 CET 2013


> DEF:A=<rrdfile>:A:AVERAGE
> DEF:B=<rrdfile>:B:AVERAGE
> 
> VDEF:TA=A,TOTAL
> VDEF:TB=B,TOTAL
> 
> CDEF:TAB=TA,TB,ADDNAN

You can't do this as you've put it, but there is a way to trick it.

Basically, a VDEF defines a single value (possibly with a time component), working on using a summary function over a dataset.  In your case, the dataset is A and the summary function that reduces this set to a single value is TOTAL.

A CDEF, on the other hand, works on a dataset.  This means that you MUST have a source dataset to work on, even if you subsequently dispose of it!  In your function, TA and TB are scalars, so there is no dataset to work on.  A dataset comes from a DEF or from another CDEF, which is why you're seeing the error message telling you to use one of these in your CDEF.

Try this:

CDEF:TAB=A,POP,TA,TB,ADDNAN

This might seem to be redundant, but the initial 'A' loads in a dataset and initialises the output dataset.  Then, you push the scalars TA and TB onto EACH entry in the dataset and add them, resulting in a new dataset, though the value at each time point is total(A+B)

You might find it better to use HRULE if all you want is a horizontal line on the graph.

I've used something similar (having a dummy DEF var pushed onto the stack and immediately popped) to allow me to create a special CDEF that is dependent of just the time (it highlights the working day hours in the background)

Steve

Steve Shipway
ITS Unix Services Design Lead
University of Auckland, New Zealand
Floor 1, 58 Symonds Street, Auckland
Phone: +64 (0)9 3737599 ext 86487
DDI: +64 (0)9 924 6487
Mobile: +64 (0)21 753 189
Email: s.shipway at auckland.ac.nz
 Please consider the environment before printing this e-mail : 打印本邮件,将减少一棵树存活的机会


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5900 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-users/attachments/20130221/701b925e/attachment-0001.bin 


More information about the rrd-users mailing list