…or at least: you think it doesn't 🙂 That's what happened to me.
I had an RRD file with a number of RRAs and different resolutions. The following is a snippet of rrdtool info with the non relevant stuff left out. …
filename = "/tmp/x01-03_cpu_idle_3677.rrd" rrd_version = "0003" step = 300 last_update = 1290615226 ds[cpu_idle].type = "COUNTER" ds[cpu_idle].minimal_heartbeat = 600 ds[cpu_idle].min = 0,0000000000e+00 ds[cpu_idle].max = 1,0000000000e+04 ds[cpu_idle].last_ds = "258249960" ds[cpu_idle].value = 3,5498196667e+05 ds[cpu_idle].unknown_sec = 0 rra[0].cf = "AVERAGE" rra[0].rows = 600 rra[0].cur_row = 599 rra[0].pdp_per_row = 1 rra[0].xff = 5,0000000000e-01 rra[0].cdp_prep[0].value = NaN rra[0].cdp_prep[0].unknown_datapoints = 0 rra[1].cf = "AVERAGE" rra[1].rows = 700 rra[1].cur_row = 699 rra[1].pdp_per_row = 6 rra[1].xff = 5,0000000000e-01 rra[1].cdp_prep[0].value = 3,2111851609e+03 rra[1].cdp_prep[0].unknown_datapoints = 0 rra[2].cf = "AVERAGE" rra[2].rows = 9216 rra[2].cur_row = 9215 rra[2].pdp_per_row = 2 rra[2].xff = 5,0000000000e-01 rra[2].cdp_prep[0].value = 0,0000000000e+00 rra[2].cdp_prep[0].unknown_datapoints = 0 rra[3].cf = "AVERAGE" rra[3].rows = 797 rra[3].cur_row = 796 rra[3].pdp_per_row = 288 rra[3].xff = 5,0000000000e-01 rra[3].cdp_prep[0].value = 3,1040640971e+05 rra[3].cdp_prep[0].unknown_datapoints = 0 . . .
I had one RRA with a 300 seconds resolution, as you can see, and I wanted to fetch it.
I calculated the timestamp for November 1st, 2010, 00:00:00 and December 1st, 2010, 00:00:00, checked (as the manual suggests) that they were multiples of 300, and I expected fetch to return 300-second samples, filling the gaps with NaN's. Instead, I got this:
$ rrdtool fetch /tmp/x*.rrd AVERAGE -s 1288566000 -e 1291158000 -r 300 | head cpu_idle 1288566600: nan 1288567200: nan 1288567800: nan 1288568400: nan 1288569000: nan 1288569600: nan 1288570200: nan 1288570800: nan
I got data in 600-second steps, which is another archive completely. Why was it???
As it turned out when asking in the rrdtool-users mailing list, fetch looks more at the number of points you are asking more than the resolution. E.g., if you ask for ten thousand points at a resolution of 300 seconds, but that archive has only 1000 points, while you have 10000 points at a resolution of 900, then it is likely that you'll see this one instead.
To verify it, I used -s 1290435000 -e 1290615000 -r 300
, and it worked! I got the data at the right resolution.
So, remember: to fetch what you want to fetch you need to:
- select a consolidation function and a resolution among those available in the RRAs
- select start/end timestamps that are multiple of the requested resolution
- check that
($end - $start)/$resolution
is not bigger than the number of points available in the desired RRA