[rrd-users] newbie question: C(++) integration with rrd

Steve Shipway s.shipway at auckland.ac.nz
Fri Sep 28 02:41:55 CEST 2012


>2. Reading temperature/fan sensors and reacting to events (like overheating 
>for example), read (and log) ree/used memory on the host system, read (and 
>log) current cache/web cache memory used/available, react (and log) to an 
>event when a particular program/process is started, and so on.
>
>For the second example above, I am aware that I could accomplish some of 
>the those things by executing various shell scripts or separate programs via 
>cron jobs, but that is not good enough for me, because I would like to have 
>everything under one roof so to speak. Besides, for some of these events, the 
>logging will be dependant on a particular system event occurring/being fired, 
>which will then use my event handler, and it, in turn, will record the relevant 
>data to rrd.

I'd be a bit wary of trying to store event-based data in an RRD.  RRD files need to have values stored on a regular interval, and will normalise the data (or invalidate it) if it doesnt come in when expected.  So, as long as your RRD is configured with (eg) a 1min interval, and you collect and store your (eg) system temperature every 1 minte, then you should be OK.  You can't only record the data when there is an 'event' (unless they happen at a predetermined regular frequency!)

If you're fully aware of that, then the librrd.a and rrdtool header files should work for you.  The C api is surprisingly similar to the other APIs and the command-line usage, so it shouldnt be too hard.

I don't know of any tutorials or references specifically on the C API, though I've been working on creating one off and on over the last year...

Steve


Steve Shipway
University of Auckland ITS
UNIX Systems Design Lead
s.shipway at auckland.ac.nz
Ph: +64 9 373 7599 ext 86487





More information about the rrd-users mailing list