[rrd-users] Fetching Data for the Finest Resolution

Jim Boren Jim.Boren at sas.com
Thu Jul 12 19:49:02 CEST 2012


Question:

How can I fetch the finest resolution while specifying e-2days for the start time?

I am rather new to working with RRDs and would like some assistance with using the fetch command to fetch data for the finest resolution.  In referring to the fetch documentation, I noticed that the finest resolution should be the default.  However, I have noticed (see RRD Information below) that the rra with a pdp_per_row of 168 is being accessed when a start time of e-2days is used.  This results in (168 * 15) / 60 = 42 minutes.  If the start time is not specified, then the rra with a pdp_per_row of 24 is being accessed.  This results in (24 * 15) / 60 = 6 minutes.

What I really want is to access the rra with a pdp_per_row of 1.  I discovered that if I specify the start time as e-1hour, then the rra with a pdp_per_row of 1 is accessed.  The question is how to access this rra with the start time of e-2days.

I tried to follow the fetch documentation for Resolution Interval using Perl like this without success:

PERL Code:
use File::Spec;
$rrdres = 1;
open(STDERR, '> ' . File::Spec->devnull);
$ctime = time;
$file = '/data/rrd_data/cpu_speed.rrd';
my($cmd) = " \"/usr/bin/rrdtool\" fetch \"$file\" AVERAGE -r $rrdres -e @{[int($ctime/$rrdres)*$rrdres]} -s e-2days |";
open(RRD, $cmd) or die "Unable to run rrdtool command:\n    $cmd\n";
my(@values) = <RRD>;
chomp @values;
print "RRDFILE=$file \n \n";
print "Command=$cmd \n \n";
print "CF= \n";
   for my $instance (@values)
      { print "$instance \n"; }


RRD Information (partial):
rrd_version = "0003"
step = 15
last_update = 1342112399
ds[sum].type = "GAUGE"
ds[sum].minimal_heartbeat = 120
ds[sum].min = NaN
ds[sum].max = NaN
ds[sum].last_ds = "2.85"
ds[sum].value = 3.9900000000e+01
ds[sum].unknown_sec = 0
rra[0].cf = "AVERAGE"
rra[0].rows = 244
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 = 244
rra[1].pdp_per_row = 24
rra[1].xff = 5.0000000000e-01
rra[1].cdp_prep[0].value = 6.8923333333e+01
rra[1].cdp_prep[0].unknown_datapoints = 0
rra[2].cf = "AVERAGE"
rra[2].rows = 244
rra[2].pdp_per_row = 168
rra[2].xff = 5.0000000000e-01
rra[2].cdp_prep[0].value = 1.3681000000e+02
rra[2].cdp_prep[0].unknown_datapoints = 0

Output from generated fetch command: /usr/bin/rrdtool" fetch "/data/rrd_data/cpu_speed.rrd" AVERAGE -r 1 -e 1342114745 -s e-2days
1341942840: 2.5270000000e+03
1341945360: 2.5270000000e+03
1341947880: 2.5270000000e+03
1341950400: 2.5270000000e+03
1341952920: 2.5270000000e+03
1341955440: 2.5270000000e+03
1341957960: 2.5270000000e+03
1341960480: 2.5270000000e+03
1341963000: 2.5270000000e+03
1341965520: 2.5270000000e+03
1341968040: 2.5270000000e+03
1341970560: 2.5270000000e+03
1341973080: 2.5270000000e+03
1341975600: 2.5270000000e+03
1341978120: 2.5270000000e+03
1341980640: 2.5270000000e+03
1341983160: 2.5270000000e+03
1341985680: 2.5270000000e+03
1341988200: 2.5270000000e+03
1341990720: 2.5270000000e+03
1341993240: 2.5270000000e+03
1341995760: 2.5270000000e+03
1341998280: 2.5270000000e+03
1342000800: 2.5270000000e+03
1342003320: 2.5270000000e+03
1342005840: 2.5270000000e+03
1342008360: 2.5270000000e+03
1342010880: 2.5270000000e+03
1342013400: 2.5270000000e+03
1342015920: 2.5270000000e+03
1342018440: 2.5270000000e+03
1342020960: 2.5270000000e+03
1342023480: 2.5270000000e+03
1342026000: 2.5270000000e+03
1342028520: 2.5270000000e+03
1342031040: 2.5270000000e+03
1342033560: 2.5270000000e+03
1342036080: 2.5270000000e+03
1342038600: 2.5270000000e+03
1342041120: 2.5270000000e+03
1342043640: 2.5270000000e+03
1342046160: 2.5270000000e+03
1342048680: 2.5270000000e+03
1342051200: 2.5270000000e+03
1342053720: 2.5270000000e+03
1342056240: 2.5270000000e+03
1342058760: 2.5270000000e+03
1342061280: 2.5270000000e+03
1342063800: 2.5270000000e+03
1342066320: 2.5270000000e+03
1342068840: 2.5270000000e+03
1342071360: 2.5270000000e+03
1342073880: 2.5270000000e+03
1342076400: 2.5270000000e+03
1342078920: 2.5270000000e+03
1342081440: 2.5270000000e+03
1342083960: 2.5270000000e+03
1342086480: 2.5270000000e+03
1342089000: 2.5270000000e+03
1342091520: 2.5270000000e+03
1342094040: 2.5270000000e+03
1342096560: 2.5270000000e+03
1342099080: 2.5270000000e+03
1342101600: 2.5270000000e+03
1342104120: 2.5270000000e+03
1342106640: 2.5270000000e+03
1342109160: 2.5270000000e+03
1342111680: 2.5270000000e+03
1342114200: 2.5270000000e+03
1342116720: nan
--
Thanks,

Jim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20120712/cdbb4162/attachment-0001.htm 


More information about the rrd-users mailing list