[rrd-users] Average value over last ten minutes?
Jack Bates
7tx7id at nottheoilrig.com
Mon Jul 9 10:49:40 CEST 2012
On 08/07/12 02:37 PM, Steve Shipway wrote:
>> I created an RRD with "-s 60", so I think it should record a data point every
>> minute? I then try to get the average value over the last ten minutes with
>> "rrdtool fetch example.rrd AVERAGE -r 600 -s -600", but instead of one average
>> value, it returns eleven values, each one minute apart
>
> You don't say what RRAs you have defined in your RRD. Although -s60 means a step size of 60 and therefore sample (pdp) at interval 60s, what is actually stored depends on your RRAs.
>
> Assuming you have defined an RRA with 1cdp=1pdp, then you will be storing data at 60s intervals, too. You COULD create an RRA with 1cdp=10pdp, which will store data at 10min averages (which is apparently what you want).
>
> Using FETCH will retrieve the data as stored in the RRA. If you do not have a 10min RRA, or if your requested time period does not exactly match the 10min RRA periods, then you will use the 1min RRA (and get 11 samples).
>
> This second case is important. If you ask for a start of 12:00 and an end of 12:10, this actually covers 11 1-minute periods. A 1min RRA would cover 12:00:00 - 12:09:59, so asking for and end of 12:10:00 means you've gone into the next 'bucket'. The closest match would be 11 samples from the 1min RRA rather than 2 samples from the 10min RRA so that's what you get. RRDtool will use the closest match from the available RRAs that gives as much or more than you ask for.
>
> Of course, if you've not created a 10min RRA then you're bound to get 1min samples.
>
> If you instead use rrdtool XPORT then calculations can be performed, and you can obtain 10min intervals even if you do not have a 10min RRA available.
>
> Hope this helps!
Fantastic, thank you very much for this help!
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
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.
More information about the rrd-users
mailing list