[rrd-developers] Accelerator Daemon

Florian Forster rrdtool at nospam.verplant.org
Fri Jul 18 08:53:59 CEST 2008


Hi Bernhard,

On Tue, Jul 15, 2008 at 02:55:39PM -0700, Bernard Li wrote:
> However, I need to get past the hurdle of setting this up.

setting this up is fairly easy:

> I assume I need to pull the rrdtool code from trunk and apply your
> patch?

Right, this is in any case the very first step ;) The patch *might*
apply to the release, too, but I wouldn't bet on it. After all the patch
touches a fair amount of files..

First (with which I mean: `then' ;), start the daemon. It does not have
a configuration file so you have to pass all relevant options on the
command line. (I'm sure that packages will let you configure the daemon
using /etc/default/rrdcached and an appropriate init script.) The most
interesting options are the following, for a complete list of all
options please consult the rrdcached(1) manpage:
- `-l <address>' Address to which the daemon should bind. Since
  networking sockets may lead to security problems, the most interesting
  solution is to use UNIX domain sockets. The daemon automatically
  switches from network to UNIX domain sockets if the address is
  prefixed with `unix:'. For example:
    -l unix:/var/run/rrdcached.sock
- `-w <timeout>' Timeout after which to write all values for one file to
  disk. This is the setting which basically equals the ``backup to
  disk'' step with the tmpfs approach. If, for example, your RRD files
  have a 300 second interval and you set this to 18000 seconds
  (5 hours), 60 values will be written at once.

So, to start the daemon listening at `/var/run/rrdcached.sock' and
writing values to disk every five hours, you'd do:
 $ bin/rrdcached -l unix:/var/run/rrdcached.sock -w 18000

Now you need to tell the `rrdtool' application to use the daemon. For
that, most commands have know the `--daemon' option. This option takes
the same addresses as the daemon's `-l' option, so for example you could
do:
 $ bin/rrdtool update --daemon unix:/var/run/rrdcached.sock \
 > /var/lib/rrd/test.rrd N:1234
 $ bin/rrdtool graph --daemon unix:/var/run/rrdcached.sock \
 > DEF:avg=/var/lib/rrd/test.rrd:value:AVERAGE \
 > [...]

If you don't want to specify the `--daemon' option again and again, you
can instead set the `RRDCACHED_ADDRESS' environment variable and omit
the `--daemon' option:
 $ RRDCACHED_ADDRESS="unix:/var/run/rrdcached.sock"
 $ export RRDCACHED_ADDRESS
 $ bin/rrdtool fetch /var/lib/rrd/test.rrd AVERAGE -s -3600
 [... output ...]

The same works for the non-threadsafe C API and, with that, for the Perl
bindings. Unfortunately I have no idea how the other bindings work and
which API they use.

The threadsafe API does NOT know how to handle the daemon. If you're
using the threadsafe API you need talk to the daemon directly. The
prototypes of the appropriate functions are in `includes/rrd_client.h'
(after `make install').

Hope this helps to get you started ;)
-octo
-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20080718/fcc2bab0/attachment.bin 


More information about the rrd-developers mailing list