[rrd-users] CDEF:a=TIME throws error

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Sat May 8 19:04:27 CEST 2010


----- Original Message ----- 
From: "itsmemattchung" <itsmemattchung at gmail.com>
To: <rrd-users at lists.oetiker.ch>
Sent: Saturday, May 08, 2010 6:35 PM
Subject: [rrd-users] CDEF:a=TIME throws error



> I have followed the documentation
> http://oss.oetiker.ch/rrdtool/tut/cdeftutorial.en.html
> in order to calculate the derivative by using
> CDEF:a=TIME
> CDEF:b=PREV(a)

Which is, unfortunately, incorrect.

My name is still on the tutorial, but the data filtering was not written by 
me. Nevertheless, sorry for the confusion.

I have no idea who made that contribution, hopefully Tobi can tell and ask 
him/her for a fix.

> "rrdtool.error: rpn expressions without DEF or CDEF variables are not
> supported "
> After searching around on google and through existing tickets, I ran 
> across
> http://oss.oetiker.ch/rrdtool-trac/ticket/182 which states exactly what I 
> am
> experiencing.
>
> Unfortunately, I am having a hard time interpreting what oetiker posted

Think of DEF and CDEF as working on arrays. Each array member is an interval 
of time combined with a rate valid during that interval.  The array members 
are better known as "steps", or "intervals", or CDPs (Consolidated Data 
Points).

What TIME does, is to take the timestamp of such an interval.  You can then 
do whatever it is you need to do. But, in order for RRDtool to find the 
timestamp of such an interval, it first needs the array of intervals.  In 
"CDEF:time=TIME" there is no data thus no array thus no interval thus no 
timestamp.

Quick fix is to put DEF "var" on the stack and remove it again: 
CDEF:time=var,POP,TIME
I haven't verified that this will make the example work, but try it.

> When would the syntax from the tutorial (CDEF:a=TIME) be appropriate? If
> possible, can someone please elaborate on why that doesn't work, or point 
> be
> in the right direction so I can better understand?

I hope this helped.
cheers,
Alex



More information about the rrd-users mailing list