Fieldname.cdef allows you to manipulate the data collected in an rrd. Things like turning bytes into bits, making numbers negative, and a host of other operations.


In this example down_bytes is the fieldname, and we are multiplying 'down_bytes' by 8 in order to get bits. The operand,operand,operator notation is know as Reverse Polish Notation.

down_bytes.cdef down_bytes,8,*

This can be used to accomplish any number of tasks. Such as taking a number reported as Milliseconds and changing it to Sec, then making the number negative to display on the bottom of the graph:

time_ms.cdef 0,time_ms,1000,/,-

If the underlying numbers are incomplete, i.e. there are unknowns and lost values, cdef allows for using "UN":

  total.cdef done,UN,0,done,IF,new,UN,0,new,IF,pending,UN,0,pending,IF,+,+
             '---------------' '-------------' '---------------------'
                  done              new                pending

What happens above is that each of the fields "done", "new" and "pending" are evaluated, showing the value 0 if the underlying value isn't there. Finally, it adds up the results from each of the evaluated fields to form a total, even if the original value is unknown or lost.


CDEF Tutorial
FAQ CDEF entry

Last modified at 2013-01-29T13:15:59+01:00 Last modified on 2013-01-29T13:15:59+01:00