[rrd-users] Re: C/C++ vs. rddtool

Per Jessen per at computer.org
Tue Jul 26 19:20:58 MEST 2005

Kevin C. wrote:

> Hi RRDTool Users & Per Jessen, Zürich
>>> Is it possible to use rddtool within C/C++ application?
>> Probably not what you intended, but what I do is to attach a thread
>> running rrdtool.
>> Whenever I need to update or get a graph or whatever, I simply write the
>> appropriate commands to stdin of that thread.
> Cool! Please tell me more details.

Not much to it, really: 

As part of initialisation of a daemon, I fork a thread that does an execve() of 
"usr/bin/rrdtool - ".  I then massage the file-descriptors such that I end up with a set
pointing to this threads stdin.  

To do an rrd update, I write a string to the rrdtool-stdin: 

(this is a printf-style template): 

"update %s -t x1:x2:x3:x4:x5 %lu:%lu:%lu:%lu:%lu:%lu\r\n"

Like I said initially, I doubt if this is really what you are after?  

Having said that, it works really well - unless you're doing 10s of thousands updates per
minute or something like that.

/Per Jessen, Zürich

http://www.spamchek.com/freetrial - managed anti-spam and anti-virus solution.
Sign up for your free 30-day trial now!

Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi

More information about the rrd-users mailing list