Merge branch 'collectd-5.3' into collectd-5.4
authorFlorian Forster <octo@collectd.org>
Thu, 26 Feb 2015 11:49:58 +0000 (12:49 +0100)
committerFlorian Forster <octo@collectd.org>
Thu, 26 Feb 2015 11:49:58 +0000 (12:49 +0100)
ChangeLog
src/collectd-exec.pod
src/dbi.c
src/exec.c

index a2c46f0..a996c68 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        * zfs_arc plugin: Support for FreeBSD has been added. Thanks to Xin Li
          for his patch.
 
+2015-02-26, Version 5.3.2
+       * Build system: Numerous fixes. Thanks to Bjørn Nordbø, Jim Radford,
+         KOMEDA Shinji, Lauri Tirkkonen, Manuel Luis Sanmartin Rozada, Marc
+         Fournier, Rainer Müller, Yoga Ramalingam and Yves Mettier. #326,
+         #373, #653, #828
+       * collectd: A use-after-free has been fixed in the "parse_value()"
+         function. Thanks to Matthias Urlichs.
+       * collectd: Fix carriage return sign in types_list Thanks to Marc
+         Fournier and @NsLib.
+       * collectd: Fix programming error in src/configfile.c Thanks to
+         Wilfried Goesgens.
+       * collectd: An off-by-one error has been fixed in the
+         "strstripnewline()" function. Patch by Florian Forster.
+       * collectd: Use the complain mechanism to report filter chain write
+         failures. Thanks to Sebastian Harl.
+       * collectd: Spelling and grammar of error messages have been fixed.
+         Thanks to Katelyn Perry and Tim Laszlo.
+       * collectdctl: Fixed buffering issues which caused trouble on AIX and
+         Solaris. Thanks to Yoga Ramalingam.
+       * Documentation: Details and example about multi-instance filterchain
+         targets have been added. Thanks to Marc Fournier.
+       * Documentation: The "CollectStatistics" option of the rrdcached has
+         been documented. Thanks to Micha Krause. #907
+       * Documentation: The write_redis has been documented. Thanks to Marc
+         Fournier.
+       * Documentation: The synopsis of the threshold has been fixed. Thanks
+         to Fabien Wernli.
+       * Documentation: The "GraphiteSeparateInstances" and
+         "GraphiteAlwaysAppendDS" options of the amqp have been documented.
+         Thanks to Marc Fournier.
+       * aggregation: "utils_vl_lookup": A race when creating user objects
+         has been fixed. Thanks to Sebastian Harl. #535
+       * cpu: Temperature code for Mac&nbsp;OS&nbsp;X has been removed.
+         Thanks to Florian Forster and Marc Fournier. #22
+       * csv: A regression which would lead to the "DataDir" option to be
+         ignored has been fixed. Thanks to Manuel Luis Sanmartin Rozada.
+       * curl, curl-json, curl-xml and write_http plugins: Call
+         "curl_global_init()" in the plugins' "init()" callback. Thanks to
+         Jeremy Katz.
+       * curl and memcachec plugins: Fix calculation of gauge, average,
+         minimum and maximum. Previously, they were calculated from the start
+         of the daemon, which is not the documented behavior. Thanks to
+         Florian Forster. #663
+       * dbi plugin: Compatibility with new versions of libdbi has been
+         restored. Thanks to Florian Forster. #950
+       * exec, unixsock plugins: Fix parsing of the "time" option of the
+         "PUTNOTIF" command. Thanks to Adrian Miron. #477
+       * java: Conversion from Java's time representation to collectd's
+         representation has been fixed. Thanks to Manuel Luis Sanmartín
+         Rozada.
+       * ipmi: A conflict with the java over the "SIGUSR2" signal has been
+         fixed. Thanks to Vincent Bernat. #114
+       * java: Make sure "cjni_thread_detach()" is called on all paths.
+         Thanks to Florian Forster.
+       * logfile and syslog plugins: Avoid total silence in case of a
+         misconfiguration. Thanks to Marc Fournier and Wilfried Goesgens.
+       * memcached: Connecting to a UNIX socket has been fixed. Thanks to Jim
+         Radford.
+       * network: Support for recent versions of gcrypt has been added.
+         Thanks to Vincent Bernat. #632
+       * network: Robustness of the client connecting behavior has been
+         improved. Thanks to Florian Forster. #627
+       * python: Don't create empty "meta_data_t" objects. Thanks to Florian
+         Forster. #716
+       * python: Fix Py list length check in "cpy_build_meta()". Thanks to
+         Yoga Ramalingam.
+       * python: The "interval" member was fixed to export seconds as a
+         double. Thanks to Justin Burnham.
+       * replace and set targets: Fix error message. Thanks to Marc Fournier.
+         #448
+       * rrdtool and rrdcached plugins: Honor the "DataDir" config option;
+         this fixes a regression. Thanks to Florian Forster. #380
+       * rrdtool and rrdcached plugins: A memory leak when creating RRD files
+         has been fixed. Thanks to Yves Mettier. #661
+       * snmp: Fix a memory leak. Thanks to Marc Fournier and Pierre-Yves
+         Ritschard. #610, #804
+       * swap: Fix behavior under OpenVZ by making "cached" optional. Thanks
+         to Florian Forster. #733
+       * threshold: Population of the "time" field in notifications has been
+         added. Thanks to Manuel Luis Sanmartín Rozada.
+       * libvirt: Only gather stats for running domains. Thanks to Ruben
+         Kerkhof.
+       * write_graphite: Escape characters not supported by Graphite. Thanks
+         to Pierre-Yves Ritschard and Marc Fournier.
+       * write_http: Make callback names context-dependent. Thanks to Marc
+         Fournier. #821
+       * write_riemann: Receive acknowledge message when using TCP. Thanks to
+         John-John Tedro.
+
 2013-07-13, Version 5.3.1
        * Documentation: Various fixes.
        * Configuration: Fix error handling: Errors in included files were
index 2c59630..fd9b3a0 100644 (file)
@@ -188,13 +188,13 @@ The data is passed to the executables over C<STDIN> in a format very similar to
 HTTP: At first there is a "header" with one line per field. Every line consists
 of a field name, ended by a colon, and the associated value until end-of-line.
 The "header" is ended by two newlines immediately following another,
-i.E<nbsp>e. an empty line. The rest, basically the "body", is the message of
-the notification.
+i.e. an empty line. The rest, basically the "body", is the message of the
+notification.
 
 The following is an example notification passed to a program:
 
   Severity: FAILURE
-  Time: 1200928930
+  Time: 1200928930.515
   Host: myhost.mydomain.org
   \n
   This is a test notification to demonstrate the format
@@ -210,7 +210,9 @@ Severity of the notification. May either be B<FAILURE>, B<WARNING>, or B<OKAY>.
 
 =item B<Time>
 
-The time in epoch, i.E<nbsp>e. as seconds since 1970-01-01 00:00:00 UTC.
+The time in epoch, i.e. as seconds since 1970-01-01 00:00:00 UTC. The value
+currently has millisecond precision (i.e. three decimal places), but scripts
+should accept arbitrary numbers of decimal places, including no decimal places.
 
 =item B<Host>
 
index 80488d8..2d3f566 100644 (file)
--- a/src/dbi.c
+++ b/src/dbi.c
@@ -1,6 +1,6 @@
 /**
  * collectd - src/dbi.c
- * Copyright (C) 2008-2013  Florian octo Forster
+ * Copyright (C) 2008-2015  Florian octo Forster
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
 
 #include <dbi/dbi.h>
 
+/* libdbi 0.9.0 introduced a new thread-safe interface and marked the old
+ * functions "deprecated". These macros convert the new functions to their old
+ * counterparts for backwards compatibility. */
+#if !defined(LIBDBI_VERSION) || (LIBDBI_VERSION < 900)
+# define HAVE_LEGACY_LIBDBI 1
+# define dbi_initialize_r(a,inst) dbi_initialize(a)
+# define dbi_shutdown_r(inst) dbi_shutdown()
+# define dbi_set_verbosity_r(a,inst) dbi_set_verbosity(a)
+# define dbi_driver_list_r(a,inst) dbi_driver_list(a)
+# define dbi_driver_open_r(a,inst) dbi_driver_open(a)
+#endif
+
 /*
  * Data types
  */
@@ -63,6 +75,9 @@ typedef struct cdbi_database_s cdbi_database_t; /* }}} */
 /*
  * Global variables
  */
+#if !defined(HAVE_LEGACY_LIBDBI) || !HAVE_LEGACY_LIBDBI
+static dbi_inst          dbi_instance  = 0;
+#endif
 static udb_query_t     **queries       = NULL;
 static size_t            queries_num   = 0;
 static cdbi_database_t **databases     = NULL;
@@ -429,20 +444,20 @@ static int cdbi_init (void) /* {{{ */
     return (-1);
   }
 
-  status = dbi_initialize (NULL);
+  status = dbi_initialize_r (/* driverdir = */ NULL, &dbi_instance);
   if (status < 0)
   {
-    ERROR ("dbi plugin: cdbi_init: dbi_initialize failed with status %i.",
+    ERROR ("dbi plugin: cdbi_init: dbi_initialize_r failed with status %i.",
         status);
     return (-1);
   }
   else if (status == 0)
   {
-    ERROR ("dbi plugin: `dbi_initialize' could not load any drivers. Please "
+    ERROR ("dbi plugin: `dbi_initialize_r' could not load any drivers. Please "
         "install at least one `DBD' or check your installation.");
     return (-1);
   }
-  DEBUG ("dbi plugin: cdbi_init: dbi_initialize reports %i driver%s.",
+  DEBUG ("dbi plugin: cdbi_init: dbi_initialize_r reports %i driver%s.",
       status, (status == 1) ? "" : "s");
 
   return (0);
@@ -650,16 +665,16 @@ static int cdbi_connect_database (cdbi_database_t *db) /* {{{ */
     db->connection = NULL;
   }
 
-  driver = dbi_driver_open (db->driver);
+  driver = dbi_driver_open_r (db->driver, dbi_instance);
   if (driver == NULL)
   {
-    ERROR ("dbi plugin: cdbi_connect_database: dbi_driver_open (%s) failed.",
+    ERROR ("dbi plugin: cdbi_connect_database: dbi_driver_open_r (%s) failed.",
         db->driver);
     INFO ("dbi plugin: Maybe the driver isn't installed? "
         "Known drivers are:");
-    for (driver = dbi_driver_list (NULL);
+    for (driver = dbi_driver_list_r (NULL, dbi_instance);
         driver != NULL;
-        driver = dbi_driver_list (driver))
+        driver = dbi_driver_list_r (driver, dbi_instance))
     {
       INFO ("dbi plugin: * %s", dbi_driver_get_name (driver));
     }
@@ -804,6 +819,9 @@ static int cdbi_read (void) /* {{{ */
   int success = 0;
   int status;
 
+  /* TODO(octo): Starting with libdbi 0.9.0, there is an "instance" argument to
+   * the *_r-functions. We should probably have multiple read callbacks instead
+   * of this loop. */
   for (i = 0; i < databases_num; i++)
   {
     status = cdbi_read_database (databases[i]);
index b9a7365..cfd82a3 100644 (file)
@@ -744,8 +744,8 @@ static void *exec_notification_one (void *arg) /* {{{ */
 
   fprintf (fh,
       "Severity: %s\n"
-      "Time: %u\n",
-      severity, (unsigned int)CDTIME_T_TO_TIME_T(n->time));
+      "Time: %.3f\n",
+      severity, CDTIME_T_TO_DOUBLE (n->time));
 
   /* Print the optional fields */
   if (strlen (n->host) > 0)