185
185
operation ignores all NAN-values in a sliding window and computes the
186
186
average of the remaining values.
188
B<PREDICT, PREDICTSIGMA>
190
Create a "sliding window" average/sigma of another data series, that also
191
shifts the data series by given amounts of of time as well
193
Usage - explicit stating shifts:
194
CDEF:predict=<shift n>,...,<shift 1>,n,<window>,x,PREDICT
195
CDEF:sigma=<shift n>,...,<shift 1>,n,<window>,x,PREDICTSIGMA
197
Usage - shifts defined as a base shift and a number of time this is applied
198
CDEF:predict=<shift multiplier>,-n,<window>,x,PREDICT
199
CDEF:sigma=<shift multiplier>,-n,<window>,x,PREDICTSIGMA
202
CDEF:predict=172800,86400,2,1800,x,PREDICT
204
This will create a half-hour (1800 second) sliding window average/sigma of x, that
205
average is essentially computed as shown here:
207
+---!---!---!---!---!---!---!---!---!---!---!---!---!---!---!---!---!--->
210
<----------------------->
214
<----------------------------------------------->
218
<----------------------->
222
<----------------------------------------------->
226
Value at sample (t0) will be the average between (t0-shift1-window) and (t0-shift1)
227
and between (t0-shift2-window) and (t0-shift2)
228
Value at sample (t1) will be the average between (t1-shift1-window) and (t1-shift1)
229
and between (t1-shift2-window) and (t1-shift2)
232
The function is by design NAN-safe.
233
This also allows for extrapolation into the future (say a few days)
234
- you may need to define the data series whit the optional start= parameter, so that
235
the source data series has enough data to provide prediction also at the beginning of a graph...
237
Here an example, that will create a 10 day graph that also shows the
238
prediction 3 days into the future with its uncertainty value (as defined by avg+-4*sigma)
239
This also shows if the prediction is exceeded at a certain point.
241
rrdtool graph image.png --imgformat=PNG \
242
--start=-7days --end=+3days --width=1000 --height=200 --alt-autoscale-max \
243
DEF:value=value.rrd:value:AVERAGE:start=-14days \
244
LINE1:value#ff0000:value \
245
CDEF:predict=86400,-7,1800,value,PREDICT \
246
CDEF:sigma=86400,-7,1800,value,PREDICTSIGMA \
247
CDEF:upper=predict,sigma,3,*,+ \
248
CDEF:lower=predict,sigma,3,*,- \
249
LINE1:predict#00ff00:prediction \
250
LINE1:upper#0000ff:upper\ certainty\ limit \
251
LINE1:lower#0000ff:lower\ certainty\ limit \
252
CDEF:exceeds=value,UN,0,value,lower,upper,LIMIT,UN,IF \
253
TICK:exceeds#aa000080:1
255
Note: Experience has shown that a factor between 3 and 5 to scale sigma is a good
256
discriminator to detect abnormal behavior. This obviously depends also on the type
257
of data and how "noisy" the data series is.
259
This prediction can only be used for short term extrapolations - say a few days into the future-
189
261
=item Special values
282
354
Returns the rate from each defined time slot multiplied with the
283
step size. This can, for instance, return total bytes transfered
355
step size. This can, for instance, return total bytes transferred
284
356
when you have logged bytes per second. The time component returns
285
357
the number of seconds.
287
359
Example: C<VDEF:total=mydata,TOTAL>
361
=item PERCENT, PERCENTNAN
291
363
This should follow a B<DEF> or B<CDEF> I<vname>. The I<vname> is popped,
292
364
another number is popped which is a certain percentage (0..100). The
293
365
data set is then sorted and the value returned is chosen such that
294
366
I<percentage> percent of the values is lower or equal than the result.
367
For PERCENTNAN I<Unknown> values are ignored, but for PERCENT
295
368
I<Unknown> values are considered lower than any finite number for this
296
369
purpose so if this operator returns an I<unknown> you have quite a lot
297
370
of them in your data. B<Inf>inite numbers are lesser, or more, than the