Merge branch 'collectd-4.6' into collectd-4.7
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Mon, 17 Aug 2009 07:48:43 +0000 (09:48 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Mon, 17 Aug 2009 07:48:43 +0000 (09:48 +0200)
ChangeLog
contrib/collection3/bin/graph.cgi
contrib/collection3/etc/collection.conf
contrib/fedora/init.d-collectd
src/collectd.conf.pod
src/libvirt.c
src/meta_data.c
src/utils_cache.c

index d129000..1d6decb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -78,7 +78,7 @@
        * collectd: A programming error has been fixed in the notification
          code. The bug may result in an assertion failure.
        * memcached plugin: Portability fix for Solaris. Thanks to Amit Gupta
-         for reposting the bug.
+         for reporting the bug.
 
 2009-06-02, Version 4.6.3
        * Build system, various plugins: Many build fixes for FreeBSD,
index c096dc9..8a5bf85 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 use lib ('../lib');
+use utf8;
 
 use FindBin ('$RealBin');
 use Carp (qw(confess cluck));
index 492bfa2..f56d1ca 100644 (file)
@@ -441,7 +441,7 @@ GraphWidth 400
   DataSources value
   RRDTitle "Processes on {hostname}"
   RRDVerticalLabel "Processes"
-  RRDFormat "%5.1lf%s"
+  RRDFormat "%5.1lf"
   DSName running  Running
   DSName sleeping Sleeping
   DSName paging   Paging
@@ -505,8 +505,8 @@ GraphWidth 400
   DataSources value
   DSName value Temp
   RRDTitle "Temperature ({instance})"
-  RRDVerticalLabel "°Celsius"
-  RRDFormat "%4.1lf°C"
+  RRDVerticalLabel "°Celsius"
+  RRDFormat "%4.1lf°C"
 </Type>
 <Type users>
   DataSources users
@@ -532,4 +532,4 @@ GraphWidth 400
   RRDVerticalLabel "W"
   RRDFormat "%4.1lfW"
 </Type>
-# vim: set sw=2 sts=2 et syntax=apache fileencoding=latin-1 :
+# vim: set sw=2 sts=2 et syntax=apache fileencoding=utf-8 :
index 2bf877c..ea8662a 100644 (file)
@@ -54,7 +54,7 @@ case "$1" in
        start
        ;;
   condrestart)
-       [ -f /var/lock/subsys/$prog ] && restart || :
+       [ -f /var/lock/subsys/$prog ] && stop && start || :
        ;;
   *)
        echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
index 97093c8..32d877a 100644 (file)
@@ -2626,7 +2626,7 @@ matching values will be ignored.
 
 =head2 Plugin C<rrdcached>
 
-The C<rrdcached> plugin uses the RRDTool accelerator daemon, L<rrdcached(1)>,
+The C<rrdcached> plugin uses the RRDtool accelerator daemon, L<rrdcached(1)>,
 to store values to RRD files in an efficient manner. The combination of the
 C<rrdcached> B<plugin> and the C<rrdcached> B<daemon> is very similar to the
 way the C<rrdtool> plugin works (see below). The added abstraction layer
@@ -2678,7 +2678,7 @@ expected. Default is B<true>.
 
 You can use the settings B<StepSize>, B<HeartBeat>, B<RRARows>, and B<XFF> to
 fine-tune your RRD-files. Please read L<rrdcreate(1)> if you encounter problems
-using these settings. If you don't want to dive into the depths of RRDTool, you
+using these settings. If you don't want to dive into the depths of RRDtool, you
 can safely ignore these settings.
 
 =over 4
index 5acff29..6f9e5f1 100644 (file)
@@ -24,6 +24,7 @@
 #include "plugin.h"
 #include "configfile.h"
 #include "utils_ignorelist.h"
+#include "utils_complain.h"
 
 #include <libvirt/libvirt.h>
 #include <libvirt/virterror.h>
@@ -49,6 +50,8 @@ static const char *config_keys[] = {
 
 /* Connection. */
 static virConnectPtr conn = 0;
+static char *conn_string = NULL;
+static c_complain_t conn_complain = C_COMPLAIN_INIT_STATIC;
 
 /* Seconds between list refreshes, 0 disables completely. */
 static int interval = 60;
@@ -153,15 +156,13 @@ lv_config (const char *key, const char *value)
         il_interface_devices = ignorelist_create (1);
 
     if (strcasecmp (key, "Connection") == 0) {
-        if (conn != 0) {
-            ERROR ("Connection may only be given once in config file");
-            return 1;
-        }
-        conn = virConnectOpenReadOnly (value);
-        if (!conn) {
-            VIRT_ERROR (NULL, "connection failed");
+        char *tmp = strdup (value);
+        if (tmp == NULL) {
+            ERROR ("libvirt plugin: Connection strdup failed.");
             return 1;
         }
+        sfree (conn_string);
+        conn_string = tmp;
         return 0;
     }
 
@@ -253,19 +254,29 @@ lv_read (void)
     int i;
 
     if (conn == NULL) {
-        ERROR ("libvirt plugin: Not connected. Use Connection in "
-                "config file to supply connection URI.  For more information "
-                "see <http://libvirt.org/uri.html>");
-        return -1;
+        /* `conn_string == NULL' is acceptable. */
+        conn = virConnectOpenReadOnly (conn_string);
+        if (conn == NULL) {
+            c_complain (LOG_ERR, &conn_complain,
+                    "libvirt plugin: Unable to connect: "
+                    "virConnectOpenReadOnly failed.");
+            return -1;
+        }
     }
+    c_release (LOG_NOTICE, &conn_complain,
+            "libvirt plugin: Connection established.");
 
     time (&t);
 
     /* Need to refresh domain or device lists? */
     if ((last_refresh == (time_t) 0) ||
             ((interval > 0) && ((last_refresh + interval) <= t))) {
-        if (refresh_lists () != 0)
+        if (refresh_lists () != 0) {
+            if (conn != NULL)
+                virConnectClose (conn);
+            conn = NULL;
             return -1;
+        }
         last_refresh = t;
     }
 
index 2c085e3..10ccd4b 100644 (file)
@@ -383,7 +383,7 @@ int meta_data_get_string (meta_data_t *md, /* {{{ */
     return (-ENOENT);
   }
 
-  if (e->type != MD_TYPE_SIGNED_INT)
+  if (e->type != MD_TYPE_STRING)
   {
     ERROR ("meta_data_get_signed_int: Type mismatch for key `%s'", e->key);
     pthread_mutex_unlock (&md->lock);
index 4d2c554..170e2c5 100644 (file)
@@ -296,6 +296,7 @@ int uc_check_timeout (void)
     {
       DEBUG ("uc_check_timeout: %s is missing but ``uninteresting''",
          keys[i]);
+      ce = NULL;
       status = c_avl_remove (cache_tree, keys[i],
          (void *) &key, (void *) &ce);
       if (status != 0)
@@ -304,7 +305,8 @@ int uc_check_timeout (void)
       }
       sfree (keys[i]);
       sfree (key);
-      cache_free (ce);
+      if (ce != NULL)
+        cache_free (ce);
       continue;
     }