Reputation: 97
I'm trying to remove a data source from a rrd db.
I found I can do something like "rrdtool tune mydb.rrd DEL:source_name" and it works, but I want to do it from C/C++ code. I could use the system function in Linux, but I don't like the overhead.
I looked in https://oss.oetiker.ch/rrdtool/doc/librrd.en.html to see if there is something I could use, but I didn't find anything.
I also looked in the rrd source code from https://github.com/oetiker/rrdtool-1.x/tree/master/src and I found they call rrd_modify_r2() to remove sources, but this function is static, so it's not exported (as opposed to rrdc_create_r2)
So, how can I remove a source from C/C++ code ?
thanks, Catalin
Upvotes: 0
Views: 381
Reputation: 4062
You use of course rrdtool tune filename.rrd DEL:ds-name
to do this from the commandline, as you note.
However the RRDTool C bindings in librrd are not as comprehensive, and do not appear to expose this functionality. Not sure why - the modify functions is clearly useful - but thats how it seems to be.
One option you have would be to simply call the external rrdtool binary with fork/exec, passing the appropriate commandline. This is not a particularly pretty way to do it, but is more portable and compatible with the published interface.
Upvotes: 1