I'm having trouble figuring out how to generate some simple billing data from RRD files. Currently we are using RTG for billing the total Bytes transfered on any given network interface. With RTG its easy, you just sum the values in a field for all of the mysql records between a given datestamp.
RRD is probably simple to but I do not know what a lot of this means... I've been reading pages like http://docs.cacti.net/manual:087:6_reference.2_cdef but I don't know what "CDEF=SIMILAR_DATA_SOURCES_NODUPS,COUNT_SIMILAR_DS_NODUPS,/" means or where I'd use that. Is that on the command line for rrdtool? I've had some success with 'rrdtool fetch' as follows:
Code: Select all
# rrdtool fetch distb1_dca3_traffic_in_68.rrd -r 300 AVERAGE -s -1h
traffic_in traffic_out
1247606400: 8.9343488889e+01 1.0950467222e+03
1247606700: 7.5859206977e+01 1.5332273154e+03
1247607000: 7.3806117549e+01 9.9900324678e+02
1247607300: 8.1843505928e+01 8.9178179198e+02
1247607600: 8.7909303437e+01 9.1863019241e+02
1247607900: 6.9053232554e+01 9.0529769242e+02
1247608200: 1.1176974403e+02 1.2311439129e+03
1247608500: 5.4316036697e+01 9.5191461420e+02
1247608800: 7.1541956614e+01 9.1513683508e+02
1247609100: 1.0299486509e+02 9.6461444953e+02
1247609400: 5.2221065790e+01 1.0503786943e+03
1247609700: 7.7386453590e+01 8.7295411856e+02
1247610000: nan nan
Above I used "AVERAGE" in the command line because "TOTAL" is not available.
Here's an example 'info' dump for that same rrd file:
Code: Select all
# rrdtool info distb1_dca3_traffic_in_68.rrd
filename = "distb1_dca3_traffic_in_68.rrd"
rrd_version = "0003"
step = 300
last_update = 1247609702
ds[traffic_in].type = "COUNTER"
ds[traffic_in].minimal_heartbeat = 600
ds[traffic_in].min = 0.0000000000e+00
ds[traffic_in].max = 1.0000000000e+09
ds[traffic_in].last_ds = "121043549"
ds[traffic_in].value = 1.5494352159e+02
ds[traffic_in].unknown_sec = 0
ds[traffic_out].type = "COUNTER"
ds[traffic_out].minimal_heartbeat = 600
ds[traffic_out].min = 0.0000000000e+00
ds[traffic_out].max = 1.0000000000e+09
ds[traffic_out].last_ds = "1196209985"
ds[traffic_out].value = 1.7447176080e+03
ds[traffic_out].unknown_sec = 0
rra[0].cf = "AVERAGE"
rra[0].rows = 600
rra[0].cur_row = 58
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[1].cf = "AVERAGE"
rra[1].rows = 700
rra[1].cur_row = 390
rra[1].pdp_per_row = 6
rra[1].xff = 5.0000000000e-01
rra[1].cdp_prep[0].value = 2.3260238447e+02
rra[1].cdp_prep[0].unknown_datapoints = 0
rra[1].cdp_prep[1].value = 2.8879472624e+03
rra[1].cdp_prep[1].unknown_datapoints = 0
rra[2].cf = "AVERAGE"
rra[2].rows = 775
rra[2].cur_row = 133
rra[2].pdp_per_row = 24
rra[2].xff = 5.0000000000e-01
rra[2].cdp_prep[0].value = 2.3260238447e+02
rra[2].cdp_prep[0].unknown_datapoints = 0
rra[2].cdp_prep[1].value = 2.8879472624e+03
rra[2].cdp_prep[1].unknown_datapoints = 0
rra[3].cf = "AVERAGE"
rra[3].rows = 797
rra[3].cur_row = 45
rra[3].pdp_per_row = 288
rra[3].xff = 5.0000000000e-01
rra[3].cdp_prep[0].value = 2.8334995030e+04
rra[3].cdp_prep[0].unknown_datapoints = 0
rra[3].cdp_prep[1].value = 2.8095232384e+05
rra[3].cdp_prep[1].unknown_datapoints = 0
rra[4].cf = "MAX"
rra[4].rows = 600
rra[4].cur_row = 476
rra[4].pdp_per_row = 1
rra[4].xff = 5.0000000000e-01
rra[4].cdp_prep[0].value = NaN
rra[4].cdp_prep[0].unknown_datapoints = 0
rra[4].cdp_prep[1].value = NaN
rra[4].cdp_prep[1].unknown_datapoints = 0
rra[5].cf = "MAX"
rra[5].rows = 700
rra[5].cur_row = 545
rra[5].pdp_per_row = 6
rra[5].xff = 5.0000000000e-01
rra[5].cdp_prep[0].value = 1.0299486509e+02
rra[5].cdp_prep[0].unknown_datapoints = 0
rra[5].cdp_prep[1].value = 1.0503786943e+03
rra[5].cdp_prep[1].unknown_datapoints = 0
rra[6].cf = "MAX"
rra[6].rows = 775
rra[6].cur_row = 94
rra[6].pdp_per_row = 24
rra[6].xff = 5.0000000000e-01
rra[6].cdp_prep[0].value = 1.0299486509e+02
rra[6].cdp_prep[0].unknown_datapoints = 0
rra[6].cdp_prep[1].value = 1.0503786943e+03
rra[6].cdp_prep[1].unknown_datapoints = 0
rra[7].cf = "MAX"
rra[7].rows = 797
rra[7].cur_row = 636
rra[7].pdp_per_row = 288
rra[7].xff = 5.0000000000e-01
rra[7].cdp_prep[0].value = 1.9936371357e+03
rra[7].cdp_prep[0].unknown_datapoints = 0
rra[7].cdp_prep[1].value = 2.7338843667e+03
rra[7].cdp_prep[1].unknown_datapoints = 0
I can probably code something in perl or php if I have some information to get me going. It's probably really easy though, I'm just confused about rrdtool's usage or the perl module.
Thanks for any information you can provide.