[rrd-users] rrdtool fetch with a resolution != rrd_step ?

Marek Schimara marek.schimara at atos.net
Wed Mar 1 10:06:57 CET 2017


[ This is a re-post as I have changed my e-mail address but forgot to update the list membership. The original message from Feb 22 seems to have fallen into /dev/null... https://lists.oetiker.ch/pipermail/rrd-users/2017-February/thread.html ]



Hello,

I'm trying to get data out of an RRD database (created with step=10) with 30s resolution. I have read http://oss.oetiker.ch/rrdtool/doc/rrdfetch.en.html#RESOLUTION_INTERVAL and I'm using -start, -end timestamps aligned to 30. However I can't get rrdtool fetch to give me data with the requested resolution:

$ RESOLUTION=30; START=1487716590; END=1487759760; echo; date --date @$START +'start: %c %Z'; echo "$START % $RESOLUTION" | bc -l; date --date @$END +'end: %c %Z'; echo "$END % $RESOLUTION" | bc -l; echo; rrdtool fetch data.rrd MAX -r $RESOLUTION -s $START -e $END | awk -v OFS='\n' '{a[NR]=$0} END{print a[1], a[2], a[3], a[4], "...", a[NR-3], a[NR-2], a[NR-1], a[NR]}'

start: Tue Feb 21 23:36:30 2017 CET
0
end: Wed Feb 22 11:36:00 2017 CET
0

                      xmit_data            rcv_data           xmit_pkts            rcv_pkts   unicast_xmit_pkts    unicast_rcv_pkts multicast_xmit_pkts  multicast_rcv_pkts

1487716600: 2.9120188235e+04 2.9292988235e+04 1.0111176471e+02 1.0293529412e+02 1.0111176471e+02 1.0067647059e+02 0.0000000000e+00 2.2588235294e+00
1487716610: 2.2684235294e+04 2.2618447059e+04 7.8764705882e+01 7.8905882353e+01 7.8764705882e+01 7.8223529412e+01 0.0000000000e+00 6.8235294118e-01
...
1487759740: 1.3461458824e+04 1.3308352941e+04 4.6741176471e+01 4.6276470588e+01 4.6741176471e+01 4.6152941176e+01 0.0000000000e+00 1.2352941176e-01
1487759750: 2.9318400000e+04 2.9203200000e+04 1.0180000000e+02 1.0140000000e+02 1.0180000000e+02 1.0140000000e+02 0.0000000000e+00 0.0000000000e+00
1487759760: 2.9318400000e+04 2.9203200000e+04 1.0180000000e+02 1.0140000000e+02 1.0180000000e+02 1.0140000000e+02 0.0000000000e+00 0.0000000000e+00
1487759770: 2.1252705882e+04 2.1111035294e+04 7.3794117647e+01 7.3388235294e+01 7.3794117647e+01 7.3229411765e+01 0.0000000000e+00 1.5882352941e-01

   ^^^ resolution == 10 instead of 30 :-(



With '--align-start', same as in the documentation (start -1h, end implicit "now"):

$ RESOLUTION=30; echo; rrdtool fetch data.rrd MAX --align-start -r $RESOLUTION -s -1h | awk -v OFS='\n' '{a[NR]=$0} END{print a[1], a[2], a[3], a[4], "...", a[NR-3], a[NR-2], a[NR-1], a[NR]}'

                      xmit_data            rcv_data           xmit_pkts            rcv_pkts   unicast_xmit_pkts    unicast_rcv_pkts multicast_xmit_pkts  multicast_rcv_pkts

1487763970: 2.3400000000e+04 2.3253352941e+04 8.1250000000e+01 8.0764705882e+01 8.1250000000e+01 8.0720588235e+01 0.0000000000e+00 4.4117647059e-02
1487763980: 2.3400000000e+04 2.3253352941e+04 8.1250000000e+01 8.0764705882e+01 8.1250000000e+01 8.0720588235e+01 0.0000000000e+00 4.4117647059e-02
...
1487767540: 1.7740988235e+04 1.7596494118e+04 6.1600653595e+01 6.1193464052e+01 6.1600653595e+01 6.1018954248e+01 0.0000000000e+00 1.7450980392e-01
1487767550: 3.2703247059e+04 3.2597152941e+04 1.1355294118e+02 1.1319411765e+02 1.1355294118e+02 1.1317647059e+02 0.0000000000e+00 1.7647058824e-02
1487767560: -nan -nan -nan -nan -nan -nan -nan -nan
1487767570: -nan -nan -nan -nan -nan -nan -nan -nan

   ^^^ resolution == 10 instead of 30 :-(


I don't want samples every 10s for 6 hours, as by changing the resolution to 30s I can get down to 1/3 of the data volume.



Thanks for any ideas.
Marek




RRDtool version (commit ee298600):

$ rrdtool --version
RRDtool 1.6.1  Copyright by Tobias Oetiker <tobi at oetiker.ch>
               Compiled Feb  8 2017 09:39:21

$ rrdtool info data.rrd
filename = "data.rrd"
rrd_version = "0003"
step = 10
last_update = 1487766808
header_size = 2768
ds[xmit_data].index = 0
ds[xmit_data].type = "COUNTER"
ds[xmit_data].minimal_heartbeat = 60
ds[xmit_data].min = 0.0000000000e+00
ds[xmit_data].max = 1.3421772800e+10
ds[xmit_data].last_ds = "241849857024"
ds[xmit_data].value = 8.0368941176e+04
ds[xmit_data].unknown_sec = 0
ds[rcv_data].index = 1
ds[rcv_data].type = "COUNTER"
ds[rcv_data].minimal_heartbeat = 60
ds[rcv_data].min = 0.0000000000e+00
ds[rcv_data].max = 1.3421772800e+10
ds[rcv_data].last_ds = "242676343452"
ds[rcv_data].value = 8.1995294118e+04
ds[rcv_data].unknown_sec = 0
ds[xmit_pkts].index = 2
ds[xmit_pkts].type = "COUNTER"
ds[xmit_pkts].minimal_heartbeat = 60
ds[xmit_pkts].min = 0.0000000000e+00
ds[xmit_pkts].max = 1.3421772800e+10
ds[xmit_pkts].last_ds = "839756448"
ds[xmit_pkts].value = 2.7905882353e+02
ds[xmit_pkts].unknown_sec = 0
ds[rcv_pkts].index = 3
ds[rcv_pkts].type = "COUNTER"
ds[rcv_pkts].minimal_heartbeat = 60
ds[rcv_pkts].min = 0.0000000000e+00
ds[rcv_pkts].max = 1.3421772800e+10
ds[rcv_pkts].last_ds = "842867918"
ds[rcv_pkts].value = 2.9694117647e+02
ds[rcv_pkts].unknown_sec = 0
ds[unicast_xmit_pkts].index = 4
ds[unicast_xmit_pkts].type = "COUNTER"
ds[unicast_xmit_pkts].minimal_heartbeat = 60
ds[unicast_xmit_pkts].min = 0.0000000000e+00
ds[unicast_xmit_pkts].max = 1.3421772800e+10
ds[unicast_xmit_pkts].last_ds = "839756448"
ds[unicast_xmit_pkts].value = 2.7905882353e+02
ds[unicast_xmit_pkts].unknown_sec = 0
ds[unicast_rcv_pkts].index = 5
ds[unicast_rcv_pkts].type = "COUNTER"
ds[unicast_rcv_pkts].minimal_heartbeat = 60
ds[unicast_rcv_pkts].min = 0.0000000000e+00
ds[unicast_rcv_pkts].max = 1.3421772800e+10
ds[unicast_rcv_pkts].last_ds = "842421655"
ds[unicast_rcv_pkts].value = 2.7435294118e+02
ds[unicast_rcv_pkts].unknown_sec = 0
ds[multicast_xmit_pkts].index = 6
ds[multicast_xmit_pkts].type = "COUNTER"
ds[multicast_xmit_pkts].minimal_heartbeat = 60
ds[multicast_xmit_pkts].min = 0.0000000000e+00
ds[multicast_xmit_pkts].max = 1.3421772800e+10
ds[multicast_xmit_pkts].last_ds = "0"
ds[multicast_xmit_pkts].value = 0.0000000000e+00
ds[multicast_xmit_pkts].unknown_sec = 0
ds[multicast_rcv_pkts].index = 7
ds[multicast_rcv_pkts].type = "COUNTER"
ds[multicast_rcv_pkts].minimal_heartbeat = 60
ds[multicast_rcv_pkts].min = 0.0000000000e+00
ds[multicast_rcv_pkts].max = 1.3421772800e+10
ds[multicast_rcv_pkts].last_ds = "446263"
ds[multicast_rcv_pkts].value = 2.2588235294e+01
ds[multicast_rcv_pkts].unknown_sec = 0
rra[0].cf = "MAX"
rra[0].rows = 10000
rra[0].cur_row = 6423
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[0].cdp_prep[1].value = NaN
rra[0].cdp_prep[1].unknown_datapoints = 0
rra[0].cdp_prep[2].value = NaN
rra[0].cdp_prep[2].unknown_datapoints = 0
rra[0].cdp_prep[3].value = NaN
rra[0].cdp_prep[3].unknown_datapoints = 0
rra[0].cdp_prep[4].value = NaN
rra[0].cdp_prep[4].unknown_datapoints = 0
rra[0].cdp_prep[5].value = NaN
rra[0].cdp_prep[5].unknown_datapoints = 0
rra[0].cdp_prep[6].value = NaN
rra[0].cdp_prep[6].unknown_datapoints = 0
rra[0].cdp_prep[7].value = NaN
rra[0].cdp_prep[7].unknown_datapoints = 0



More information about the rrd-users mailing list