[prev in list] [next in list] [prev in thread] [next in thread] 

List:       collectd
Subject:    [collectd] [PATCH] plugin.c: Don't require write callbacks to be
From:       Sebastian Harl <sh () tokkee ! org>
Date:       2008-05-22 11:37:57
Message-ID: 20080522113757.GT10932 () albany ! tokkee ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


plugin_dispatch_values() used to fail, if no write callbacks had been
registered. As that function is used to update the cache and check
threshold as well, this limited the flexibility of collectd setups. Thus,
the error message has been downgraded to a one-time complaint.

Signed-off-by: Sebastian Harl <sh@tokkee.org>
---

This patch requires the reintroduction of the complain mechanism and my
latest patch to utils_llist.

---
 src/plugin.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/plugin.c b/src/plugin.c
index cbd5477..8844c33 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -21,6 +21,7 @@
  **/
 
 #include "collectd.h"
+#include "utils_complain.h"
 
 #include <ltdl.h>
 
@@ -744,6 +745,8 @@ void plugin_shutdown_all (void)
 
 int plugin_dispatch_values (value_list_t *vl)
 {
+	static c_complain_t no_write_complaint = C_COMPLAIN_INIT;
+
 	int (*callback) (const data_set_t *, const value_list_t *);
 	data_set_t *ds;
 	llentry_t *le;
@@ -754,12 +757,10 @@ int plugin_dispatch_values (value_list_t *vl)
 	}
 
 	if (list_write == NULL)
-	{
-		ERROR ("plugin_dispatch_values: No write callback has been "
-				"registered. Please load at least one plugin "
-				"that provides a write function.");
-		return (-1);
-	}
+		c_complain_once (LOG_WARNING, &no_write_complaint,
+				"plugin_dispatch_values: No write callback has been "
+				"registered. Please load at least one output plugin, "
+				"if you want the collected data to be stored.");
 
 	if (data_sets == NULL)
 	{
-- 
1.5.5.1.316.g377d9


["signature.asc" (application/pgp-signature)]

_______________________________________________
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic