[collectd] [PATCH] plugin.c: Don't require write callbacks to be present.

Sebastian Harl sh at tokkee.org
Thu May 22 13:37:57 CEST 2008


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 at 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

-------------- 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/20080522/9f552e7c/attachment.pgp 


More information about the collectd mailing list