<< Previous Section | Altering Graphs on the Fly [home] | Next Section >> |
CDEFs allow you to apply mathematical functions to graph data to alter output. The concept of a CDEF comes straight from RRDTool, and are written in reverse polish notation (RPN). For more information regarding the syntax of CDEFs, check out the CDEF tutorial. To create a new CDEF in Cacti, select the "CDEFs" option under the "Graph Setup" heading. Once on that screen, click "Add" on the right. You will be presented with a few fields to populate:
Name | Give the CDEF a name that you can use to identify it throughout Cacti. You will most commonly see this name in the graph item edit screen, where you can choose to apply a CDEF to the graph item. |
When you are finished, click the "Create" button and you will see a new "CDEF Items" box. Each CDEF must contain one or more items to be functional. To add the first item to your CDEF, click "Add" at the right of the "CDEF Items" box. You will be presented with a few fields described below of which you must only fill in one.
Function | You can choose a CDEF function to use as the item. The RRDTool graph manual describes the purpose of each CDEF function. |
Operator | Just your standard math operators, including modulo (%). |
Special Data Source | A special data source is basically a flag to tell Cacti to do some special processing when it encounters this CDEF item. The "Current Graph Item Data Source" type basically inserts the name of the data source that is referenced by the graph item that references to this CDEF. Both of the "All Data Sources" types insert a summation of all data sources used on a graph. |
Another CDEF | You can recursively use another CDEF within this CDEF. |
Custom String | Sometimes it's just easier to type out the literal CDEF string manually. When referencing to data sources on the graph, remember that Cacti names them 'a', 'b', 'c', '...', starting with the first data source on the graph. |
When you are finished filling out a field for the CDEF item, click "Create" to add it to your CDEF. You can continue to add new CDEF items until the CDEF is complete. You can now apply this to CDEF to a graph item.