i'm writing a patch to use the LSL (least square line) of rrdtool ( http://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.html )
Only for rrdtool version 1.2.x
I have created 4 new 'Special Data Source' for CDEF function :
- CURRENT_DS_LSLSLOPE : return the LSLSCOPE variable of rrdtool
CURRENT_DS_LSLINT : return the LSLINT variable of rrdtool
CURRENT_DS_LSLCORREL : return the LSLCORREL variable of rrdtool (not tested)
CURRENT_DS_LSLFUNCTION : return the y=ax+b function (y=LSLSCOPE * x + LSLINT)
CURRENT_DS_LSLFUNCTION can be used alone in a CDEF function, this will trace the line, but if the datasource is used with a CDEF function (like 'turn byte into bits'), you may create a CDEF with CURRENT_DS_LSLFUNCTION and the same operation.
exemple : if your graph is using "Turn Bytes into bits"
"Turn Bytes into bits" cdef=CURRENT_DATA_SOURCE,8,*
then , to trace the LSL line, create a cdef function like this:
"LSL Turn Bytes into bits" cdef=CURRENT_DS_LSLFUNCTION,8,*
note: LSL's functions cannot be used alone, in a CDEF function, a data_source must be present.
(exepted the CURRENT_DS_LSLFUNCTION that include automaticaly a datasource and POP it (remove from the stack in cdef))
to display the percent of evolution of the graphed period, create a cdef function
cdef=CURRENT_DATA_SOURCE,POP,CURRENT_DS_LSLSLOPE,COUNT,*,CURRENT_DS_LSLINT,0,LE,0.1,CURRENT_DS_LSLINT,IF,/,100,*
and use a GPRINT with "LAST" as Consolidation Function
Patch is for cacti 0.8.6j without official patch
copy the patch file in cacti directory
be in cacti directory to apply the patch
if you want to test before :
patch -p1 -N --dry-run < lsl.patch
patch:
patch -p1 -N < lsl.patch
-
Jerome
Sorry for my english
EDIT: version 1.1 : trace line even if data value is unknown (cf picture 2)
EDIT : version 1.2: simplify function