I need to iterate through all .rrd files inside a given directory and do fetch data inside each rrd database and do some actions and export them into single csv file in python script!
How can this be done in a efficient way? it's ok to advice me how to loop and access database data over multiple files?
I assume you have a rrdtool installation with python bindings already on your system. If not, here is an installation description.
Then, to loop over
.rrdfiles in a given directory and performing a fetch:The parameter list follows rrdfetch.
Once you have whatever data you need inside the
rrd_filesloop, you should accumulate it in a list of lists, with each sublist being one row of data. Writing them to acsvis as easy as this:This should outline the general steps you have to follow, you will probably need to adapt them (the
rrdfetchin particular) to your case.