Merge branch 'collectd-4.9' into collectd-4.10
authorFlorian Forster <octo@huhu.verplant.org>
Mon, 14 Mar 2011 19:06:53 +0000 (20:06 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Mon, 14 Mar 2011 19:06:53 +0000 (20:06 +0100)
src/collectd.conf.pod
src/filter_chain.c
src/plugin.c
src/processes.c
src/python.c

index bfb7309..187133c 100644 (file)
@@ -1911,8 +1911,10 @@ Hostname of the database server. Defaults to B<localhost>.
 =item B<User> I<Username>
 
 Username to use when connecting to the database. The user does not have to be
-granted any privileges (which is synonym to granting the C<USAGE> privilege).
-Any existing MySQL user will do.
+granted any privileges (which is synonym to granting the C<USAGE> privilege),
+unless you want to collectd replication statistics (see B<MasterStats> and
+B<SlaveStats> below). In this case, the user needs the C<REPLICATION CLIENT>
+(or C<SUPER>) privileges. Else, any existing MySQL user will do.
 
 =item B<Password> I<Password>
 
@@ -1944,7 +1946,9 @@ C<mysql_real_connect> function for details.
 
 =item B<SlaveStats> I<true|false>
 
-Enable the collection of master / slave statistics in a replication setup.
+Enable the collection of master / slave statistics in a replication setup. In
+order to be able to get access to these statistics, the user needs special
+privileges. See the B<User> documentation above.
 
 =item B<SlaveNotifications> I<true|false>
 
@@ -2712,7 +2716,8 @@ and are checked by default depends on the distribution you use.
 This plugin sends a desktop notification to a notification daemon, as defined
 in the Desktop Notification Specification. To actually display the
 notifications, B<notification-daemon> is required and B<collectd> has to be
-able to access the X server.
+able to access the X server (i.E<nbsp>e., the C<DISPLAY> and C<XAUTHORITY>
+environment variables have to be set correctly) and the D-Bus message bus.
 
 The Desktop Notification Specification can be found at
 L<http://www.galago-project.org/specs/notification/>.
index 4b164dc..ed2df61 100644 (file)
@@ -22,6 +22,7 @@
 #include "collectd.h"
 #include "configfile.h"
 #include "plugin.h"
+#include "utils_complain.h"
 #include "common.h"
 #include "filter_chain.h"
 
@@ -692,10 +693,15 @@ static int fc_bit_write_invoke (const data_set_t *ds, /* {{{ */
 
   if ((plugin_list == NULL) || (plugin_list[0] == NULL))
   {
+    static c_complain_t enoent_complaint = C_COMPLAIN_INIT_STATIC;
+
     status = plugin_write (/* plugin = */ NULL, ds, vl);
     if (status == ENOENT)
     {
-      INFO ("Filter subsystem: Built-in target `write': Dispatching value to "
+      /* in most cases this is a permanent error, so use the complain
+       * mechanism rather than spamming the logs */
+      c_complain (LOG_INFO, &enoent_complaint,
+          "Filter subsystem: Built-in target `write': Dispatching value to "
           "all write plugins failed with status %i (ENOENT). "
           "Most likely this means you didn't load any write plugins.",
           status);
@@ -705,6 +711,13 @@ static int fc_bit_write_invoke (const data_set_t *ds, /* {{{ */
       INFO ("Filter subsystem: Built-in target `write': Dispatching value to "
           "all write plugins failed with status %i.", status);
     }
+    else
+    {
+      assert (status == 0);
+      c_release (LOG_INFO, &enoent_complaint, "Filter subsystem: "
+          "Built-in target `write': Some write plugin is back to normal "
+          "operation. `write' succeeded.");
+    }
   }
   else
   {
index af894d5..9b7cb21 100644 (file)
@@ -280,8 +280,6 @@ static int plugin_load_file (char *file, uint32_t flags)
        lt_dlhandle dlh;
        void (*reg_handle) (void);
 
-       DEBUG ("file = %s", file);
-
        lt_dlinit ();
        lt_dlerror (); /* clear errors */
 
@@ -297,23 +295,35 @@ static int plugin_load_file (char *file, uint32_t flags)
        }
 #else /* if LIBTOOL_VERSION == 1 */
        if (flags & PLUGIN_FLAGS_GLOBAL)
-               ERROR ("plugin_load_file: The global flag is not supported, "
+               WARNING ("plugin_load_file: The global flag is not supported, "
                                "libtool 2 is required for this.");
        dlh = lt_dlopen (file);
 #endif
 
        if (dlh == NULL)
        {
-               const char *error = lt_dlerror ();
+               char errbuf[1024] = "";
+
+               ssnprintf (errbuf, sizeof (errbuf),
+                               "lt_dlopen (\"%s\") failed: %s. "
+                               "The most common cause for this problem are "
+                               "missing dependencies. Use ldd(1) to check "
+                               "the dependencies of the plugin "
+                               "/ shared object.",
+                               file, lt_dlerror ());
+
+               ERROR ("%s", errbuf);
+               /* Make sure this is printed to STDERR in any case, but also
+                * make sure it's printed only once. */
+               if (list_log != NULL)
+                       fprintf (stderr, "ERROR: %s\n", errbuf);
 
-               ERROR ("lt_dlopen (%s) failed: %s", file, error);
-               fprintf (stderr, "lt_dlopen (%s) failed: %s\n", file, error);
                return (1);
        }
 
        if ((reg_handle = (void (*) (void)) lt_dlsym (dlh, "module_register")) == NULL)
        {
-               WARNING ("Couldn't find symbol `module_register' in `%s': %s\n",
+               WARNING ("Couldn't find symbol \"module_register\" in \"%s\": %s\n",
                                file, lt_dlerror ());
                lt_dlclose (dlh);
                return (-1);
index 30798d4..7a5a9c0 100644 (file)
@@ -1594,9 +1594,9 @@ static int ps_read (void)
        procs = kvm_getprocs(kd, KERN_PROC_ALL, 0, &count);
        if (procs == NULL)
        {
-               kvm_close (kd);
                ERROR ("processes plugin: Cannot get kvm processes list: %s",
                                kvm_geterr(kd));
+               kvm_close (kd);
                return (0);
        }
 
index c056b5b..d5c2d46 100644 (file)
@@ -345,26 +345,26 @@ static int cpy_write_callback(const data_set_t *ds, const value_list_t *value_li
                        CPY_RETURN_FROM_THREADS 0;
                }
                for (i = 0; i < value_list->values_len; ++i) {
-                       if (ds->ds->type == DS_TYPE_COUNTER) {
+                       if (ds->ds[i].type == DS_TYPE_COUNTER) {
                                if ((long) value_list->values[i].counter == value_list->values[i].counter)
                                        PyList_SetItem(list, i, PyInt_FromLong(value_list->values[i].counter));
                                else
                                        PyList_SetItem(list, i, PyLong_FromUnsignedLongLong(value_list->values[i].counter));
-                       } else if (ds->ds->type == DS_TYPE_GAUGE) {
+                       } else if (ds->ds[i].type == DS_TYPE_GAUGE) {
                                PyList_SetItem(list, i, PyFloat_FromDouble(value_list->values[i].gauge));
-                       } else if (ds->ds->type == DS_TYPE_DERIVE) {
+                       } else if (ds->ds[i].type == DS_TYPE_DERIVE) {
                                if ((long) value_list->values[i].derive == value_list->values[i].derive)
                                        PyList_SetItem(list, i, PyInt_FromLong(value_list->values[i].derive));
                                else
                                        PyList_SetItem(list, i, PyLong_FromLongLong(value_list->values[i].derive));
-                       } else if (ds->ds->type == DS_TYPE_ABSOLUTE) {
+                       } else if (ds->ds[i].type == DS_TYPE_ABSOLUTE) {
                                if ((long) value_list->values[i].absolute == value_list->values[i].absolute)
                                        PyList_SetItem(list, i, PyInt_FromLong(value_list->values[i].absolute));
                                else
                                        PyList_SetItem(list, i, PyLong_FromUnsignedLongLong(value_list->values[i].absolute));
                        } else {
                                Py_BEGIN_ALLOW_THREADS
-                               ERROR("cpy_write_callback: Unknown value type %d.", ds->ds->type);
+                               ERROR("cpy_write_callback: Unknown value type %d.", ds->ds[i].type);
                                Py_END_ALLOW_THREADS
                                Py_DECREF(list);
                                CPY_RETURN_FROM_THREADS 0;