Search code examples
rrdtoolrrd

How can I get rrdtool fetch to print out values using a 1 hr resolution


I'm trying to get rrdtool fetch to print out values with a resolution setting of 1 hr.

I've set -r to 3600 (3600 seconds for one hour), and have set the start and end times to multiples of 3600, yet rrdtool just continues to print out values in half hour increments instead of 1 hour increments.

What would I need to do to get this working properly?

This the command I'm using:

rrdtool fetch -e 1498672800 -s e-5h -r 3600 /opt/observium/rrd/dcwinsciv001-vl2541.edc.nam.gm.com/cras_sessions.rrd AVERAGE

and these are the values that I get in return:

 1498656600: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 9.8753100135e+02 0.0000000000e+00
1498658400: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 1.0012858198e+03 0.0000000000e+00
1498660200: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 1.0184441667e+03 0.0000000000e+00
1498662000: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 9.8139826741e+02 0.0000000000e+00
1498663800: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 9.4889630432e+02 0.0000000000e+00
1498665600: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 9.4899529819e+02 0.0000000000e+00
1498667400: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 9.4413469288e+02 0.0000000000e+00
1498669200: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 9.3376060699e+02 0.0000000000e+00
1498671000: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 9.4768248388e+02 0.0000000000e+00
1498672800: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 9.4868378807e+02 0.0000000000e+00
1498674600: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 9.4866400630e+02 0.0000000000e+00

Solution

  • When you use rrdfetch, then RRDTool will attempt to return the closest set of data to your requirements that it can. However, what is possible depends on the RRAs that you have defined in the RRD file.

    You requested an interval of 3600 (1hr) but your extracted data has an interval of 1800 (30min). This means that either -

    • You do not have an interval-3600, AVG cf RRA defined in your RRD file, or
    • You have one defined, but it does not cover the time window you have requested (watch out for fencepost errors)

    If it is too troublesome to define a whole new RRA with a 1-hour consolodation, then you also have the option to use rrdtool xport. This is similar to rrdgraph in that it will consolodate on the fly, but it outputs the data rather than an image. This is less efficient than using rrdfetch with a correctly-defined RRA, though.

    rrdtool xport -e 1498672800 -s e-5h --step 3600 \ DEF:data=cras_sessions.rrd:dsname:AVERAGE \ XPORT:data:Data

    This example assumes your DS is called dsname, and will output the values at the requested 3600 resolution, as it will consolodate the 30min data on the fly.