[rrd-developers] Patch: Prediction CDEF functions for rrdtool 1.3

Tobias Oetiker tobi at oetiker.ch
Fri Nov 7 15:02:27 CET 2008


Hi Martin,

thanks for the patch, I have added it.

cheers
tobi

Yesterday Martin Sperl wrote:

> 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
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900



More information about the rrd-developers mailing list