Search code examples
fetchrrdtoolwc

rrdtool fetch output


I want to get an average of last 7 days readings from rrd database. I am using the rrdtool fetch for the same then calculating the average. I ran the following commands:

> rrdtool fetch  /var/www/cloudrrd1/Divya.rrd AVERAGE -r 300 -s -1days -e now | wc -l
291
> rrdtool fetch  /var/www/cloudrrd1/Divya.rrd AVERAGE -r 300 -s -2days -e now | wc -l
579
> rrdtool fetch  /var/www/cloudrrd1/Divya.rrd AVERAGE -r 300 -s -3days -e now | wc -l
126
> rrdtool fetch  /var/www/cloudrrd1/Divya.rrd AVERAGE -r 300 -s -4days -e now | wc -l
167
> rrdtool fetch  /var/www/cloudrrd1/Divya.rrd AVERAGE -r 300 -s -5days -e now | wc -l
208
> rrdtool fetch  /var/www/cloudrrd1/Divya.rrd AVERAGE -r 300 -s -6days -e now | wc -l
249
> rrdtool fetch  /var/www/cloudrrd1/Divya.rrd AVERAGE -r 300 -s -7days -e now | wc -l
291

I am confused on the number of readings. Shouldn't it always increase with the increase in no. of days ? or am i doing something wrong ?


Solution

  • rrdtool fetch favores a match in coverage over a match in resolution. so if only a lower resolution rra will cover the requested time span, rrdtool will give you this and thus return fewer results ... check the timestamps in the first column of the answer.