Merge remote-tracking branch 'github/pr/1931'
authorFlorian Forster <octo@collectd.org>
Wed, 14 Sep 2016 11:59:05 +0000 (13:59 +0200)
committerFlorian Forster <octo@collectd.org>
Wed, 14 Sep 2016 11:59:05 +0000 (13:59 +0200)
ChangeLog
contrib/migrate-4-5.px
src/apache.c
src/collectd.conf.in
src/collectd.conf.pod
src/curl_json.c
src/match_regex.c
version-gen.sh

index 4e969b5..5155954 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,161 @@
+2016-09-11, Version 5.6.0
+       * Build system: An option to to avoid building the DF plugin against XFS
+         has been added. Thanks to Ruben Kerkhof. #1878
+       * Build system: Autoconf ≥ 2.60, a C99-capable compiler and pkg-config
+         are now required. Thanks to Ruben Kerkhof.
+       * Build system: Building with "-Werror" is now optional. Thanks to Ruben
+         Kerkhof. #1222
+       * Build system: Many compilation issues on non-Linux platforms have been
+         fixed, leading to wider plugin support. Thanks to Ruben Kerkhof,
+         Dagobert Michelsen, Havard Eidnes and Robert Viduya.
+       * Build system: The configuration summary now also ends up in
+         config.log. Thanks to Sebastian Harl.
+       * collectd: All command-line options now override global options from
+         the config file. Thanks to Sebastian Harl. #366
+       * collectd: A number of unit tests for commonly used functions have been
+         added. Thanks to Florian Forster.
+       * collectd: Plugins start up and read timeouts are now logged. Thanks to
+         Marc Fournier. #1293, #1254
+       * collectd: Support for a timeout has been added to "FLUSH" callbacks.
+         Thanks to Manuel Luis Sanmartín Rozada.
+       * collectd: The "-T" command line switch now reports more errors. Thanks
+         to Corey Kosak. #1642
+       * collectd: The max size of value list elements ("DATA_MAX_NAME_LEN")
+         has been doubled and is now configurable at build time. Thanks to Amy
+         Lin, Florian Forster and Radu Brumariu. #1120
+       * Set target: The "MetaData" option has been added. Thanks to Yves
+         Mettier and Kevin Bowling. #1106, #1656, #1913
+       * AMQP, Write_HTTP, Write_Kafka plugins: Support for libyajl < 2 has
+         been added. Thanks to Florian Forster.
+       * APC UPS plugin: Parsing of end markers has been fixed. Thanks to
+         Florian Forster #617
+       * APC UPS plugin: The "PersistentConnection" option has been added.
+         Thanks to Florian Forster #617
+       * ceph, DNS, Exec, IPTables, Ping, turbostat plugins: When running
+         unprivileged, these plugins will now warn about insuffiscient
+         permissions or capabilities(7). Thanks to Marc Fournier. #1530
+       * Chrony plugin: This new plugin collects NTP data from the chrony NTP
+         server. Thanks to Claudius Zingerli. #1548
+       * cpusleep plugin: This new plugin measures time spent by CPU in deep
+         sleep mode. Thanks to Rinigus. #1826
+       * CPU plugin: The "ReportNumCpu" option has been added. Thanks to Fabien
+         Wernli.
+       * cURL, cURL-JSON, cURL-XML plugins: The new "Statistics" reports
+         various per-HTTP connection timers. Thanks to Sebastian Harl. #1004
+       * DBI plugin: The "Interval" option has been added to "Database" blocks.
+         Thanks to Michal Bebjak.
+       * Disk plugin: Support for FreeBSD has been added. Thanks to Xin Li,
+         Brad Davis, Ruben Kerfhof and Kevin Bowling.
+       * Empty Counter match: Support for derives has been implemented. Thanks
+         to Florian Forster. #1813
+       * GenericJMX plugin: Support for TabularData and the "PluginName" option
+         have been added. Thanks to David Crane. #1290, #1291
+       * GPS plugin: This new plugin reports the number of sattelites seen by
+         and precision of a GPS receiver. Thanks to Nicolas Jourden. #1346
+       * gRPC plugin: This new client and server plugin allows sending and
+         receiving metrics using the gRPC protocol. Comparable to the UnixSock
+         plugin, but using TCP and TLS. Thanks to Sebastian Harl and Florian
+         Forster.
+       * Interface plugin: Reporting dropped packets has been added. Thanks to
+         Marc Falzon. #1555
+       * Interface plugin: The "ReportInactive" has been added, letting users
+         skip inactive network interfaces. Thanks to Rinigus. #1791
+       * Interface plugin: The new, Solaris-only "UniqueName" option has been
+         added. Thanks to Yoga Ramalingam. #1416
+       * Lua plugin: This new language binding allows writing plugins using the
+         Lua programming language. Thanks to Julien Ammous, Florian Forster and
+         Ruben Kerkhof.
+       * Memory plugin: Reporting of ARC memory on Solaris has been added.
+         Thanks to Brian ONeill.
+       * MQTT plugin: This new plugin sends metrics to and/or receives metrics
+         from an MQTT broker. Thanks to Marc Falzon, Jan-Piet Mens, Nicholas
+         Humfrey and Florian Forster. #805, #1124
+       * MySQL plugin: Connection to the database server can now be done over
+         SSL. Thanks to Brian Lalor. #1256
+       * MySQL plugin: Monitoring slow queries has been added. Thanks to skob.
+         #1773
+       * MySQL plugin: mysql_bpool_pages-flushed has been renamed to
+         mysql_bpool_counters-pages_flushed because the value is cumulative.
+         Thanks to Marek Becka.
+       * MySQL plugin: Support for Galera statistics has been added. Thanks to
+         Rachid Zarouali. #1849
+       * MySQL plugin: Support for InnoDB metrics was improved. Thanks to Aman
+         Gupta. #1111
+       * MySQL plugin: The "mysql_sort" type has been split into 3 different
+         types. Thanks to Pavel Rochnyack. #1592
+       * Network plugin: Decryption error logging has been improved. Thanks to
+         Pavel Rochnyack. #1735
+       * Notify Nagios plugin: This new plugin sends notifications to Nagios as
+         a passive check result. Thanks to Florian Forster.
+       * NTPd plugin: The plugin now detects if the ntp daemon reports
+         nanoseconds instead of microseconds. Thanks to Matwey V. Kornilov.
+         #1783
+       * OpenLDAP plugin: Several connection-related improvements have been
+         made. Thanks to Marc Fournier. #1308
+       * OpenLDAP plugin: Support for "simple authentication" has been added.
+         Thanks to Marek Becka. #1087
+       * Ping plugin: The "Size" option has been added, allowing the ICMP data
+         payload size to be configured. Thanks to Witold Baryluk. #1395
+       * PostgreSQL, DBI, Oracle plugins: The new "PluginInstanceFrom" option
+         has been added. Thanks to Pavel Rochnyack. #1707
+       * PowerDNS plugin: The recursor metrics have been updated to 3.7.3 and
+         missing rr types have been added. Thanks to Ruben Kerkhof.
+       * Processes plugin: Counting of context switches was added for Linux.
+         Thanks to Manuel Luis Sanmartín Rozada. #1036
+       * Processes plugin: Improve reliability of thread counts on Linux.
+         Thanks to Manuel Luis Sanmartín Rozada.
+       * Python plugin: Minimal Python version requirement has been bumped to
+         2.6. Thanks to Ruben Kerkhof. #1864
+       * Redis plugin: Several additional metrics are now collected. Thanks to
+         Marc Falzon and Matteo Contrini. #1807, #1483
+       * Sensors plugin: The "UseLabels" option has been added. Thanks to
+         Christian Fetzer.
+       * SMART plugin: The new "IgnoreSleepMode" option has been added. Thanks
+         to Scott Talbert. #1770
+       * SMART plugin: The new "UseSerial" option allows identifying devices in
+         a stable way. Thanks to Scott Talbert. #1794
+       * SNMP plugin: The "IpAddress" can now be used for instances. Thanks to
+         Vincent Bernat. #1397
+       * StatsD plugin: Latency calculation histogram is now able to shrink
+         automatically to optimal size. Thanks to Pavel Rochnyack. #1622
+       * StatsD plugin: The "CounterSum" option has been added. Thanks to
+         Florian Forster. #929, #1282, #1311
+       * UUID plugin: The plugin now also looks in in smbios system table and
+         "/sys/class/dmi". Thanks to Ruben Kerkhof. #1490
+       * virt plugin: The "PluginInstanceFormat" option has been added. Thanks
+         to Ruben Kerkhof. #1100
+       * Write Graphite plugin: The "ReconnectInterval" option has been added.
+         Thanks to Toni Moreno and Florian Forster.
+       * Write HTTP plugin: A KairosDB formatter has been added. Thanks to
+         Aurélien Rougemont. #1809
+       * Write HTTP plugin: Notifications are now handled by this plugin.
+         Thanks to Florian Forster.
+       * Write HTTP plugin: The "LogHttpError" option has been added. Thanks to
+         vzubko.
+       * Write HTTP plugin: The new "Headers" option allows setting custom HTTP
+         headers in outgoing requests. Thanks to Brandon Arp. #1634
+       * Write Kafka plugin: Key handling has been made more comprehensive and
+         reliable. Thanks to Florian Forster, Pierre-Yves Ritschard and Vincent
+         Bernat. #1765, #1695, #1393
+       * Write Redis plugin: The "Database", "MaxSetSize", "Prefix" and
+         "StoreRates" options have been added. Thanks to Brian Kelly and
+         Sebastian Pfahl.
+       * Write Riemann plugin: The new "BatchFlushTimeout" and "Timeout" option
+         have been added. Thanks to Pierre-Yves Ritschard and Gergely Nagy.
+       * Write Riemann plugin: This plugin now requires the riemann-c-client
+         library, version 1.6.0+. This adds support for submitting values to
+         Riemann over TLS. Thanks to Gergely Nagy. #986
+       * Write TSDB, Write Sensu, Write Riemann, Write Graphite, Write TSDB
+         plugin: TCP keepalive is now enabled, helping graceful recovery from
+         unclean network disconnections. Thanks to Marc Fournier. #1549
+       * XenCPU plugin: This new plugin collects XEN Hypervisor CPU stats.
+         Thanks to Pavel Rochnyack. #1608
+       * ZFS ARC plugin: Several new statistics have been added and a couple of
+         obsolete ones removed. Thanks to Brad Davis, Brian ONeill and Ruben
+         Kerkhof.
+       * Zone plugin: This new plugin reads per-zone CPU usage on Solaris.
+         Thanks to Mathijs Mohlmann and Dagobert Michelsen.
+
 2016-07-25, Version 5.5.2
        * collectd: A division by zero has been fixed in the
          "plugin_dispatch_multivalue()" function. Thanks to Corey Kosak.
index c2a9555..8e5a7ed 100755 (executable)
@@ -104,8 +104,6 @@ our %TypesCounterToDerive = # {{{
   protocol_counter => ["value"],
   ps_cputime => ["user", "syst"],
   ps_pagefaults => ["minflt", "majflt"],
-  ps_code => ["value"],
-  ps_data => ["value"],
   serial_octets => ["rx", "tx"],
   swap_io => ["value"],
   virt_cpu_total => ["ns"],
index 20a2a3c..578b8de 100644 (file)
@@ -244,7 +244,7 @@ static int config_add (oconfig_item_t *ci)
                ssnprintf (callback_name, sizeof (callback_name),
                                "apache/%s/%s",
                                (st->host != NULL) ? st->host : hostname_g,
-                               (st->name != NULL) ? st->name : "default"),
+                               (st->name != NULL) ? st->name : "default");
 
                status = plugin_register_complex_read (/* group = */ NULL,
                                /* name      = */ callback_name,
index 7ac9f2d..6a207ab 100644 (file)
 #    StoreRates true
 #    AlwaysAppendDS false
 #    EscapeCharacter "_"
+#    SeparateInstances false
 #    DropDuplicateFields false
 #  </Node>
 #</Plugin>
index 4f95425..baef1c3 100644 (file)
@@ -241,6 +241,12 @@ Path to the plugins (shared objects) of collectd.
 Set one or more files that contain the data-set descriptions. See
 L<types.db(5)> for a description of the format of this file.
 
+If this option is not specified, a default file is read. If you need to define
+custom types in addition to the types defined in the default file, you need to
+explicitly load both. In other words, if the B<TypesDB> option is encountered
+the default behavior is disabled and if you need the default types you have to
+also explicitly load them.
+
 =item B<Interval> I<Seconds>
 
 Configures the interval in which to query the read plugins. Obviously smaller
@@ -9119,6 +9125,8 @@ Available options:
 
 =item B<TypeInstance> I<Regex>
 
+=item B<MetaData> I<String> I<Regex>
+
 Match values where the given regular expressions match the various fields of
 the identifier of a value. If multiple regular expressions are given, B<all>
 regexen must match for a value to match.
index 5824431..4dab1ab 100644 (file)
@@ -144,6 +144,9 @@ static int cj_get_type (cj_key_t *key)
 {
   const data_set_t *ds;
 
+  if ((key == NULL) || !CJ_IS_KEY (key))
+    return -EINVAL;
+
   ds = plugin_get_ds (key->type);
   if (ds == NULL)
   {
@@ -227,12 +230,15 @@ static int cj_cb_number (void *ctx,
   buffer[sizeof (buffer) - 1] = 0;
 
   if ((key == NULL) || !CJ_IS_KEY (key)) {
-    if (key != NULL && !db->state[db->depth].in_array/*can be inhomogeneous*/)
+    if (key != NULL && !db->state[db->depth].in_array/*can be inhomogeneous*/) {
       NOTICE ("curl_json plugin: Found \"%s\", but the configuration expects"
               " a map.", buffer);
+      return (CJ_CB_CONTINUE);
+    }
+
     cj_cb_inc_array_index (ctx, /* update_key = */ 1);
     key = db->state[db->depth].key;
-    if (key == NULL) {
+    if ((key == NULL) || !CJ_IS_KEY (key)) {
       return (CJ_CB_CONTINUE);
     }
   }
index cd63016..dd8319e 100644 (file)
 
 #include "collectd.h"
 
+#include "common.h"
 #include "filter_chain.h"
+#include "meta_data.h"
+#include "utils_llist.h"
 
 #include <sys/types.h>
 #include <regex.h>
@@ -64,6 +67,7 @@ struct mr_match_s
        mr_regex_t *plugin_instance;
        mr_regex_t *type;
        mr_regex_t *type_instance;
+       llist_t *meta;  /* Maps each meta key into mr_regex_t* */
        _Bool invert;
 };
 
@@ -77,7 +81,7 @@ static void mr_free_regex (mr_regex_t *r) /* {{{ */
 
        regfree (&r->re);
        memset (&r->re, 0, sizeof (r->re));
-       free (r->re_str);
+       sfree (r->re_str);
 
        if (r->next != NULL)
                mr_free_regex (r->next);
@@ -93,8 +97,14 @@ static void mr_free_match (mr_match_t *m) /* {{{ */
        mr_free_regex (m->plugin_instance);
        mr_free_regex (m->type);
        mr_free_regex (m->type_instance);
+       for (llentry_t *e = llist_head(m->meta); e != NULL; e = e->next)
+       {
+               sfree (e->key);
+               mr_free_regex ((mr_regex_t *) e->value);
+       }
+       llist_destroy (m->meta);
 
-       free (m);
+       sfree (m);
 } /* }}} void mr_free_match */
 
 static int mr_match_regexen (mr_regex_t *re_head, /* {{{ */
@@ -127,31 +137,25 @@ static int mr_match_regexen (mr_regex_t *re_head, /* {{{ */
        return (FC_MATCH_MATCHES);
 } /* }}} int mr_match_regexen */
 
-static int mr_config_add_regex (mr_regex_t **re_head, /* {{{ */
-               oconfig_item_t *ci)
+static int mr_add_regex (mr_regex_t **re_head, const char *re_str, /* {{{ */
+               const char *option)
 {
        mr_regex_t *re;
        int status;
 
-       if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
-       {
-               log_warn ("`%s' needs exactly one string argument.", ci->key);
-               return (-1);
-       }
-
        re = calloc (1, sizeof (*re));
        if (re == NULL)
        {
-               log_err ("mr_config_add_regex: calloc failed.");
+               log_err ("mr_add_regex: calloc failed.");
                return (-1);
        }
        re->next = NULL;
 
-       re->re_str = strdup (ci->values[0].value.string);
+       re->re_str = strdup (re_str);
        if (re->re_str == NULL)
        {
-               free (re);
-               log_err ("mr_config_add_regex: strdup failed.");
+               sfree (re);
+               log_err ("mr_add_regex: strdup failed.");
                return (-1);
        }
 
@@ -162,9 +166,9 @@ static int mr_config_add_regex (mr_regex_t **re_head, /* {{{ */
                regerror (status, &re->re, errmsg, sizeof (errmsg));
                errmsg[sizeof (errmsg) - 1] = 0;
                log_err ("Compiling regex `%s' for `%s' failed: %s.",
-                               re->re_str, ci->key, errmsg);
-               free (re->re_str);
-               free (re);
+                               re->re_str, option, errmsg);
+               sfree (re->re_str);
+               sfree (re);
                return (-1);
        }
 
@@ -184,8 +188,78 @@ static int mr_config_add_regex (mr_regex_t **re_head, /* {{{ */
        }
 
        return (0);
+} /* }}} int mr_add_regex */
+
+static int mr_config_add_regex (mr_regex_t **re_head, /* {{{ */
+               oconfig_item_t *ci)
+{
+       if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
+       {
+               log_warn ("`%s' needs exactly one string argument.", ci->key);
+               return (-1);
+       }
+
+       return mr_add_regex (re_head, ci->values[0].value.string, ci->key);
 } /* }}} int mr_config_add_regex */
 
+static int mr_config_add_meta_regex (llist_t **meta, /* {{{ */
+               oconfig_item_t *ci)
+{
+       char *meta_key;
+       llentry_t *entry;
+       mr_regex_t *re_head;
+       int status;
+       char buffer[1024];
+
+       if ((ci->values_num != 2)
+               || (ci->values[0].type != OCONFIG_TYPE_STRING)
+               || (ci->values[1].type != OCONFIG_TYPE_STRING))
+       {
+               log_warn ("`%s' needs exactly two string arguments.", ci->key);
+               return (-1);
+       }
+
+       if (*meta == NULL)
+       {
+               *meta = llist_create();
+               if (*meta == NULL)
+               {
+                       log_err ("mr_config_add_meta_regex: llist_create failed.");
+                       return (-1);
+               }
+       }
+
+       meta_key = ci->values[0].value.string;
+       entry = llist_search (*meta, meta_key);
+       if (entry == NULL)
+       {
+               meta_key = strdup (meta_key);
+               if (meta_key == NULL)
+               {
+                       log_err ("mr_config_add_meta_regex: strdup failed.");
+                       return (-1);
+               }
+               entry = llentry_create (meta_key, NULL);
+               if (entry == NULL)
+               {
+                       log_err ("mr_config_add_meta_regex: llentry_create failed.");
+                       sfree (meta_key);
+                       return (-1);
+               }
+               /* meta_key and entry will now be freed by mr_free_match(). */
+               llist_append (*meta, entry);
+       }
+
+       ssnprintf (buffer, sizeof (buffer), "%s `%s'", ci->key, meta_key);
+       /* Can't pass &entry->value into mr_add_regex, so copy in/out. */
+       re_head = entry->value;
+       status = mr_add_regex (&re_head, ci->values[1].value.string, buffer);
+       if (status == 0) {
+               entry->value = re_head;
+       }
+       return status;
+} /* }}} int mr_config_add_meta_regex */
+
 static int mr_create (const oconfig_item_t *ci, void **user_data) /* {{{ */
 {
        mr_match_t *m;
@@ -216,6 +290,8 @@ static int mr_create (const oconfig_item_t *ci, void **user_data) /* {{{ */
                        status = mr_config_add_regex (&m->type, child);
                else if (strcasecmp ("TypeInstance", child->key) == 0)
                        status = mr_config_add_regex (&m->type_instance, child);
+               else if (strcasecmp ("MetaData", child->key) == 0)
+                       status = mr_config_add_meta_regex (&m->meta, child);
                else if (strcasecmp ("Invert", child->key) == 0)
                        status = cf_util_get_boolean(child, &m->invert);
                else
@@ -236,7 +312,8 @@ static int mr_create (const oconfig_item_t *ci, void **user_data) /* {{{ */
                                && (m->plugin == NULL)
                                && (m->plugin_instance == NULL)
                                && (m->type == NULL)
-                               && (m->type_instance == NULL))
+                               && (m->type_instance == NULL)
+                               && (m->meta == NULL))
                {
                        log_err ("No (valid) regular expressions have been configured. "
                                        "This match will be ignored.");
@@ -295,6 +372,25 @@ static int mr_match (const data_set_t __attribute__((unused)) *ds, /* {{{ */
        if (mr_match_regexen (m->type_instance,
                                vl->type_instance) == FC_MATCH_NO_MATCH)
                return (nomatch_value);
+       if (vl->meta != NULL)
+       {
+               for (llentry_t *e = llist_head(m->meta); e != NULL; e = e->next)
+               {
+                       mr_regex_t *meta_re = (mr_regex_t *) e->value;
+                       char *value;
+                       int status = meta_data_get_string (vl->meta, e->key, &value);
+                       if (status == (-ENOENT))  /* key is not present */
+                               return (nomatch_value);
+                       if (status != 0)  /* some other problem */
+                               continue;  /* error will have already been printed. */
+                       if (mr_match_regexen (meta_re, value) == FC_MATCH_NO_MATCH)
+                       {
+                               sfree (value);
+                               return (nomatch_value);
+                       }
+                       sfree (value);
+               }
+       }
 
        return (match_value);
 } /* }}} int mr_match */
index 70b8c26..2ef5279 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-DEFAULT_VERSION="5.5.2.git"
+DEFAULT_VERSION="5.6.0.git"
 
 if [ -d .git ]; then
        VERSION="`git describe --dirty=+ --abbrev=7 2> /dev/null | grep collectd | sed -e 's/^collectd-//' -e 's/-/./g'`"