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

bd at bc-bd.org bd at bc-bd.org
Tue Feb 26 00:49:34 CET 2008


On Mon, Feb 25, 2008 at 11:13:15PM +0100, Sebastian Harl wrote:
> Hi,
> On Mon, Feb 25, 2008 at 07:58:31PM +0100, bd at bc-bd.org wrote:
> > A small patch enabling collectd to write the rrdtool cache onto
> > the disk upon receiving SIGUSR1.
> Imho this patch is a very good idea. I'm just wondering if this can
> somehow be managed by the daemon itself. I don't really like the idea of
> having plugins handling any signals. I currently have a lot of other
> stuff on my mind, so I won't come up with any good ideas right now...
> any ideas are welcome ;-)

Extending the plugin api comes to my mind, eg


and catching USR1 in the main thread, then call _flush for all plugins.

Or make the pthread mutex available in collectd.c and signal on it when
the plugin should flush, although this would be more intrusive and a lot
more rrdtool plugin specific and would not scale to other plugins.

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.

Right now I'd prefer the first variant, since the other two have kind of
an icky feeling to them.


Graduate life: It's not just a job.  It's an indenture.

More information about the collectd mailing list