308
308
source value is \s-1NAN\s0 the complete sliding window is affected. The \s-1TRENDNAN\s0
309
309
operation ignores all NAN-values in a sliding window and computes the
310
310
average of the remaining values.
312
\&\fB\s-1PREDICT\s0, \s-1PREDICTSIGMA\s0\fR
314
Create a \*(L"sliding window\*(R" average/sigma of another data series, that also
315
shifts the data series by given amounts of of time as well
317
Usage \- explicit stating shifts:
318
CDEF:predict=<shift n>,...,<shift 1>,n,<window>,x,PREDICT
319
CDEF:sigma=<shift n>,...,<shift 1>,n,<window>,x,PREDICTSIGMA
321
Usage \- shifts defined as a base shift and a number of time this is applied
322
CDEF:predict=<shift multiplier>,\-n,<window>,x,PREDICT
323
CDEF:sigma=<shift multiplier>,\-n,<window>,x,PREDICTSIGMA
326
CDEF:predict=172800,86400,2,1800,x,PREDICT
328
This will create a half-hour (1800 second) sliding window average/sigma of x, that
329
average is essentially computed as shown here:
332
\& +\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\->
335
\& <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
337
\& <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
339
\& <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
341
\& <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
343
\& <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
345
\& <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
347
\& <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
349
\& <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
351
\& Value at sample (t0) will be the average between (t0\-shift1\-window) and (t0\-shift1)
352
\& and between (t0\-shift2\-window) and (t0\-shift2)
353
\& Value at sample (t1) will be the average between (t1\-shift1\-window) and (t1\-shift1)
354
\& and between (t1\-shift2\-window) and (t1\-shift2)
357
The function is by design NAN-safe.
358
This also allows for extrapolation into the future (say a few days)
359
\&\- you may need to define the data series whit the optional start= parameter, so that
360
the source data series has enough data to provide prediction also at the beginning of a graph...
362
Here an example, that will create a 10 day graph that also shows the
363
prediction 3 days into the future with its uncertainty value (as defined by avg+\-4*sigma)
364
This also shows if the prediction is exceeded at a certain point.
366
rrdtool graph image.png \-\-imgformat=PNG \e
367
\-\-start=\-7days \-\-end=+3days \-\-width=1000 \-\-height=200 \-\-alt\-autoscale\-max \e
368
DEF:value=value.rrd:value:AVERAGE:start=\-14days \e
369
LINE1:value#ff0000:value \e
370
CDEF:predict=86400,\-7,1800,value,PREDICT \e
371
CDEF:sigma=86400,\-7,1800,value,PREDICTSIGMA \e
372
CDEF:upper=predict,sigma,3,*,+ \e
373
CDEF:lower=predict,sigma,3,*,\- \e
374
LINE1:predict#00ff00:prediction \e
375
LINE1:upper#0000ff:upper\e certainty\e limit \e
376
LINE1:lower#0000ff:lower\e certainty\e limit \e
377
CDEF:exceeds=value,UN,0,value,lower,upper,LIMIT,UN,IF \e
378
TICK:exceeds#aa000080:1
380
Note: Experience has shown that a factor between 3 and 5 to scale sigma is a good
381
discriminator to detect abnormal behavior. This obviously depends also on the type
382
of data and how \*(L"noisy\*(R" the data series is.
384
This prediction can only be used for short term extrapolations \- say a few days into the future\-
311
385
.IP "Special values" 4
312
386
.IX Item "Special values"
313
387
\&\fB\s-1UNKN\s0\fR
391
465
.IP "\s-1TOTAL\s0" 4
393
467
Returns the rate from each defined time slot multiplied with the
394
step size. This can, for instance, return total bytes transfered
468
step size. This can, for instance, return total bytes transferred
395
469
when you have logged bytes per second. The time component returns
396
470
the number of seconds.
398
472
Example: \f(CW\*(C`VDEF:total=mydata,TOTAL\*(C'\fR
399
.IP "\s-1PERCENT\s0" 4
473
.IP "\s-1PERCENT\s0, \s-1PERCENTNAN\s0" 4
474
.IX Item "PERCENT, PERCENTNAN"
401
475
This should follow a \fB\s-1DEF\s0\fR or \fB\s-1CDEF\s0\fR \fIvname\fR. The \fIvname\fR is popped,
402
476
another number is popped which is a certain percentage (0..100). The
403
477
data set is then sorted and the value returned is chosen such that
404
478
\&\fIpercentage\fR percent of the values is lower or equal than the result.
479
For \s-1PERCENTNAN\s0 \fIUnknown\fR values are ignored, but for \s-1PERCENT\s0
405
480
\&\fIUnknown\fR values are considered lower than any finite number for this
406
481
purpose so if this operator returns an \fIunknown\fR you have quite a lot
407
482
of them in your data. \fBInf\fRinite numbers are lesser, or more, than the