I'm using rrdtool library in python. Same python script returned data a day back, but now suddenly it's returning None object inside the tuples generated. The rrd files haven't been modified. Type of returned is tuple and even the rrdinfo if getting printed.Please spare some time to look into it.
import sys
import pprint
sys.path.append('/opt/plexus-srv/rrdtool-1.4.9/lib64/python2.6/site-
packages')
import rrdtool
rrd_file = sys.argv[1]
rrd_info = rrdtool.info(rrd_file)
data = rrdtool.fetch(rrd_file,"AVERAGE")
print(type(data))
pp = pprint.PrettyPrinter(indent =4)
pp.pprint(data)
pp.pprint(rrd_info)
Output is:
<type 'tuple'>
('sum',)
1510142400
[(None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,)]
{ 'ds[sum].index': 0L,
'ds[sum].last_ds': '99.3',
'ds[sum].max': None,
'ds[sum].min': None,
'ds[sum].minimal_heartbeat': 120L,
'ds[sum].type': 'GAUGE',
'ds[sum].unknown_sec': 0L,
'ds[sum].value': 1290.8999999999999,
'filename': '/home/u43555766/aad/plexus/rrdsample/testing/cpu/cpu_idle.rrd',
'header_size': 1416L,
'last_update': 1510030543L,
'rra[0].cdp_prep[0].unknown_datapoints': 0L,
'rra[0].cdp_prep[0].value': None,
'rra[0].cf': 'AVERAGE',
'rra[0].cur_row': 49L,
'rra[0].pdp_per_row': 1L,
'rra[0].rows': 490L,
'rra[0].xff': 0.5,
'rra[1].cdp_prep[0].unknown_datapoints': 0L,
'rra[1].cdp_prep[0].value': 198.78666666666669,
'rra[1].cf': 'AVERAGE',
'rra[1].cur_row': 2264L,
'rra[1].pdp_per_row': 4L,
'rra[1].rows': 2890L,
'rra[1].xff': 0.5,
'rra[2].cdp_prep[0].unknown_datapoints': 0L,
'rra[2].cdp_prep[0].value': 198.78666666666669,
'rra[2].cf': 'AVERAGE',
'rra[2].cur_row': 873L,
'rra[2].pdp_per_row': 20L,
'rra[2].rows': 2026L,
'rra[2].xff': 0.5,
'rra[3].cdp_prep[0].unknown_datapoints': 0L,
'rra[3].cdp_prep[0].value': 22058.293333333328,
'rra[3].cf': 'AVERAGE',
'rra[3].cur_row': 387L,
'rra[3].pdp_per_row': 240L,
'rra[3].rows': 754L,
'rra[3].xff': 0.5,
'rra[4].cdp_prep[0].unknown_datapoints': 0L,
'rra[4].cdp_prep[0].value': 117354.74000000028,
'rra[4].cf': 'AVERAGE',
'rra[4].cur_row': 214L,
'rra[4].pdp_per_row': 5760L,
'rra[4].rows': 375L,
'rra[4].xff': 0.5,
'rrd_version': '0003',
'step': 15L}
The most obvious answer to the question is that there is no data to return.
You do not say if and how you have added data to the RRD file. Since your 'fetch' call does not have any parameters to specify the resolution,start or end, then it will likely get the default of one day, ending now, in 5min resolution. You do have an RRA matching that, but we cannot know if there is any data in there.
Looking at the data you did provide, it seems that you're running fetch at time 1510142400 but the RRD last update was at 1510030543, about 31 hours earlier. Probably no data present for the last day?
Try running 'rrdtool fetch' and 'rrdtool dump' from the commandline, and verify that there are data stored, and that they are for the times you think. Maybe pass additional parameters to 'fetch' to specify step, start and end.