I need to get specific data field from rrdtool. Here I have xml output of my rrdfile.
<ds>
<name> gauge1 </name>
<type> COUNTER </type>
<minimal_heartbeat> 600 </minimal_heartbeat>
<min> 0.0000000000e+00 </min>
<max> 1.0000000000e+08 </max>
<!-- PDP Status -->
<last_ds> 10109068304313 </last_ds>
<value> 1.2791603667e+05 </value>//need to read this value
<unknown_sec> 0 </unknown_sec>
</ds>
<ds>
<name> gauge2 </name>
<type> COUNTER </type>
<minimal_heartbeat> 600 </minimal_heartbeat>
<min> 0.0000000000e+00 </min>
<max> 1.0000000000e+08 </max>
<!-- PDP Status -->
<last_ds> 8604908605180 </last_ds>
<value> 1.2595538667e+05 </value>//need to read this value
<unknown_sec> 0 </unknown_sec>
</ds>
I am using following commands to read rrdfiles.
file_path=r'/data/rrd_new/XXX.rrd'
rrdfilename = file_path
rrd = rrdtool.lastupdate(rrdfilename)
time = rrd['date']
ds = rrd['ds']
print(time,ds)
But this provides output as below, which is the value of <last_ds>
2022-05-23 11:25:01 {'gauge1': 10109068304313.0, 'gauge2': 8604908605180}
But I need to get the value of and outout should be as follows,
2022-05-23 11:25:01 {'gauge1': 127916.03667, 'gauge2': 125955.38667}
Can someone help me to read this?