[rrd-developers] Patch: Prediction CDEF functions for rrdtool 1.3
Martin Sperl
rrdtool at martin.sperl.org
Thu Nov 6 23:50:35 CET 2008
Hi!
As promised in my libDBI Patch announcement a few days ago, I have now
created a patch with 2 new CDEFS that allow for some
prediction/extrapolation of values into the future by calculating
averages of values from the previous days/weeks.
Here an example image of a series with the "prediction" and its
uncertainty borders:
example image for prediction
The graph creation is achieved with:
rrdtool graph image.png --imgformat=PNG \
--start=-7days --end=+3days --width=1000 --height=200 --alt-autoscale-max \
DEF:value=value.rrd:value:AVERAGE:start=-14days \
LINE1:value#ff0000:value \
CDEF:predict=86400,-7,1800,value,PREDICT \
CDEF:sigma=86400,-7,1800,value,PREDICTSIGMA \
CDEF:upper=predict,sigma,3,*,+ \
CDEF:lower=predict,sigma,3,*,- \
LINE1:predict#00ff00:prediction \
LINE1:upper#0000ff:upper\ certainty\ limit \
LINE1:lower#0000ff:lower\ certainty\ limit \
CDEF:exceeds=value,UN,0,value,lower,upper,LIMIT,UN,IF \
TICK:exceeds#aa000080:1
The prediction is only valid for a few days into the future.
For longer term predictions another patch with a set of VDEFS/CDEFS is
planned that will use least square fitting of polynomials plus sums of
sinuses to get a reasonable prediction for time periods of 3 to 6 month
into the future. This will be based on some code that was written for my
astronomy thesis several years ago...
Attached the patch, which only touches: src/rrd_rpncalc.h
src/rrd_rpncalc.c doc/rrdgraph_rpn.pod
It also contains the documentation for the 2 new CDEFS in rrdgraph_rpn -
so in case of questions regarding usage, please read the documentation
in the patch.
Please review and give feedback, so that it may get included into one of
the next releases of rrdtool.
Thanks,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20081106/bb3b1325/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 28609 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20081106/bb3b1325/attachment-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cdef-predict.diff
Type: text/x-patch
Size: 7485 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20081106/bb3b1325/attachment-0001.bin
More information about the rrd-developers
mailing list