[rrd-users] rrdlib: Are the API functions that avoid double string conversion?

Matija Grabnar matija at serverflow.com
Thu May 29 13:29:41 CEST 2014


Maybe you should look at rrdcached - it doesn't solve your first problem 
(it accepts the numbers as a string), but it does cache the data in 
memory and only flushes it, everything at once, every once in a while 
(configurable how often).

Hope this helps.

Best regards,
                  Matija

On 05/29/2014 12:34 PM, Matthias Nagel wrote:
> Hello,
>
> I am writing a C++ application that needs to update a RRD file. A had a look into "rrd_tool.c" and I found this tread https://www.mail-archive.com/rrd-users@lists.oetiker.ch/msg10245.html. Well, I see how to get working code that does what I want to do, but actually I dislike the idea to convert the (numeric) variables of my program into an array of strings (aka argv[]) such that the function "rrd_update" can convert it back.
>
> Is there any second level of API function that are a little bit more low level? I think of a function with the following signature:
>
> int update(
>    const char* rrdFile,
>    unsigned long timestamp,
>    const unsigned int dsIndexes[],
>    const double values[]
> );
>
> Moreover, my program runs as a daemon and  the pdp step frequency is 1 second. Hence, I would like to open the rrd file only once in the beginning, perform an update every second and close the file only if the daemon terminates. (Of course, the updates should be flushed to disk once in I while, such that data isn't lost in case of a crash.) Is there anything like a concept of file handles? I.e.
>
> struct rrdfile_t { ... };
>
> int open(  const char* rrdFile, rrdfile_t* handle )
>
> int update( rrdfile_t* handle, ... /* as above */ )
>
> int close( rrdfile_t* handle )
>
>
> I had a look at "rrd_update.c" in order to find out what "rrd_update( int argc, char* argv[] )" does but that seemed a bit too low-level.
>
> Thanks, Matthias
>



More information about the rrd-users mailing list