# [rrd-users] Average value over last ten minutes?

Steve Shipway s.shipway at auckland.ac.nz
Tue Jul 10 00:55:36 CEST 2012

```> I defined only one RRA and I intended it to store ten averages, one minute
> apart, or 1cdp=1pdp, like you say: RRA:AVERAGE:.5:1:10

If I were you, I'd create at least 11 cdp in your RRA -- in fact, I'm not sure why you are not making it much larger, since this means you're throwing away the data after 10 minutes!  Surely you want to keep some historical data past that time?

> Thank you for explaining why FETCH behaves the way it does when I ask for an
> average over the last ten minutes, and suggesting that I create a ten minute
> RRA. But is it possible to create an RRA with one ten minute average, updated
> every minute?
>
> i.e. I want the most recent average of 12:00-12:10, 12:01-12:11, 12:02-12:12,
> etc. and not the most recent average of 12:00-12:10, 12:10-12:20, 12:20-12:30,
> etc.

No, this is not possible; a 10min RRA will be 12:00-12:09:56, 12:10:00-12:19:59, etc...

If you want a rolling 10min average calculated every minute, you should instead use the 'rrdtool xport' function to pull out 1min interval data, and then use a CDEF to calculate the last-10-min average by utilising the trendnan RPN function -- eg,

rrdtool xport -e now -s 'end-10min' -s 60
DEF:x=rrdfile.rrd:ds:AVERAGE CDEF:tenminavg=x,600,TRENDNAN
XPORT:tenminavg

NOTE that your 1min RRA will need to be AT LEAST 20 cdp long for this to work!  So, use RRA:AVERAGE:0.5:1:20 as a minimum.  This is from memory so check the syntax...

Hope this helps,

Steve

Steve Shipway
University of Auckland, New Zealand
Floor 1, 58 Symonds Street, Auckland
Phone: +64 (0)9 3737599 ext 86487
DDI: +64 (0)9 924 6487
Mobile: +64 (0)21 753 189
Email: s.shipway at auckland.ac.nz
 Please consider the environment before printing this e-mail

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6080 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-users/attachments/20120709/16eb1f0f/attachment.bin
```