Code

src/plugin.c: Don't require write callbacks to be present.
authorSebastian Harl <sh@tokkee.org>
Thu, 22 May 2008 11:37:57 +0000 (13:37 +0200)
committerFlorian Forster <octo@huhu.verplant.org>
Tue, 27 May 2008 11:13:44 +0000 (13:13 +0200)
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>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/plugin.c

index cbd5477509b6abfe677eb846273345ae7619a44d..8844c3397fd333a79f7959b6a81fd77ae42a1b26 100644 (file)
@@ -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)
        {