2

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 ?

Jatin Kumar
  • 2,635
  • 9
  • 36
  • 46

1 Answers1

1

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.

Tobi Oetiker
  • 5,167
  • 2
  • 17
  • 23
  • True, I was ignoring the database size too. The database size for 5 minutes resolution is for 2 days readings. And as you correctly said rrdtool looks for the correct resolution time according to the coverage demanded. – Jatin Kumar Apr 16 '12 at 17:46