[collectd] [PATCH] rrdtool plugin: Added a flush callback.

Sebastian Harl sh at tokkee.org
Tue Feb 26 18:15:28 CET 2008


Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 src/rrdtool.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/rrdtool.c b/src/rrdtool.c
index 024b04e..b955847 100644
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
@@ -947,6 +947,17 @@ static int rrd_write (const data_set_t *ds, const value_list_t *vl)
 	return (status);
 } /* int rrd_write */
 
+static int rrd_flush (const int timeout)
+{
+	if (cache == NULL)
+		return (0);
+
+	pthread_mutex_lock (&cache_lock);
+	rrd_cache_flush (timeout);
+	pthread_mutex_unlock (&cache_lock);
+	return (0);
+} /* int rrd_flush */
+
 static int rrd_config (const char *key, const char *value)
 {
 	if (strcasecmp ("CacheTimeout", key) == 0)
@@ -1157,5 +1168,6 @@ void module_register (void)
 			config_keys, config_keys_num);
 	plugin_register_init ("rrdtool", rrd_init);
 	plugin_register_write ("rrdtool", rrd_write);
+	plugin_register_flush ("rrdtool", rrd_flush);
 	plugin_register_shutdown ("rrdtool", rrd_shutdown);
 }
-- 
1.5.4.2.184.gb23b

-------------- 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/24e8d490/attachment.pgp 


More information about the collectd mailing list