[collectd] [PATCH] - flush rrdtool cache to disk on SIGUSR1

Sebastian Harl sh at tokkee.org
Tue Feb 26 12:26:12 CET 2008


Hi,

On Tue, Feb 26, 2008 at 12:03:44PM +0100, bd at bc-bd.org wrote:
> On Tue, Feb 26, 2008 at 10:35:44AM +0100, Florian Forster wrote:
> > On Tue, Feb 26, 2008 at 12:49:34AM +0100, bd at bc-bd.org wrote:
> > > Extending the plugin api comes to my mind, eg
> > > 
> > > 	plugin_register_flush(...);
> > > 
> > > and catching USR1 in the main thread, then call _flush for all plugins.
> > 
> > I like this idea a lot.
> > [...]

Ack :-)

> > > Or create a UNIX socket somewhere /tmp/collectd_flush which will
> > > trigger rrdtool.c to write its data but we would need another thread
> > > for that, though no signal handlers in the plugin.
> > 
> > I was more thinking along the lines of implementing a new command for
> > the unixsock plugin which will cause the flush, too.
> 
> If the unixsock plugin already provides the needed infrastructure all
> the better.

That's basically going to be a call to something like
plugin_flush_all() upon the appropriate command... :-)

> So we'd have two ways of flushing data, via USR1 and echo flush > ...

Hum... not quite - "echo flush > ..." is not going to work. You have to
connect to the UNIX socket just like you do with any other socket (using
the socket(2) syscall). However, frontends like the Collectd::Unixsock
perl module or the cussh.pl script provided in contrib/ may be used for
that job.

Cheers,
Sebastian

-- 
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/

Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety.         -- Benjamin Franklin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080226/08384b65/attachment.pgp 


More information about the collectd mailing list