Merge pull request #3280 from mrunge/collectd-5.9
authorMatthias Runge <mrunge@redhat.com>
Tue, 17 Sep 2019 13:18:32 +0000 (15:18 +0200)
committerGitHub <noreply@github.com>
Tue, 17 Sep 2019 13:18:32 +0000 (15:18 +0200)
Collectd 5.9

ChangeLog
configure.ac
src/network.c
src/virt.c

index b8824db..2e919a8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2019-07-24, Version 5.9.1
+       * collectd: redhat spec: fix build due to new upstream plugins. Thanks
+         to Fabien Wernli. #3175
+       * collectd: regex match: Fix unexpected match with empty meta data .
+         Thanks to Takuro Ashie. #3178
+       * collectd: Fix return value or loglevel for several plugins. Thanks to
+         Fabien Wernli. #3182
+       * collectd: Add standard include early or _FILE_OFFSET_BITS will have
+         definition … . Thanks to Dagobert Michelsen. #3193
+       * collectd: Use GCC-specific flags only when compiling with GCC. Thanks
+         to Dagobert Michelsen. #3195
+       * Use test_utils_proc_pids only when compiling the plugin that uses it.
+         Thanks to Dagobert Michelsen. #3197
+       * DNS plugin: Do not use headers from glibc. Thanks to Pavel Rochnyak.
+         #3156, #3145
+       * collectd: Add missing definitions for libnetsnmpagent. Thanks to
+         Dagobert Michelsen. #3203
+       * collectd: Move Makefile rules for pid_test inside conditional for
+         code. Thanks to Dagobert Michelsen. #3206
+       * collectd: Recover setlocale() call in src/daemon/collectd.c do_init().
+         Thanks to Pavel Rochnyak. #3214, #3181
+       * collectd: Add snprintf wrapper for GCC 8.2/3. Thanks to zebity. #3153,
+         #2895, #3038
+       * collectd: Fix bug that leads to CPPFLAGS gets overridden with CFLAGS
+         when libxmms is enabled. Thanks to Dagobert Michelsen. #3207
+       * Write_Riemann plugin: Copy MetaData to Riemann events in
+         write_riemann. Thanks to Romain Tartière. #3158
+       * virt plugin: Fix memory leak with libvirt MetadataXPath enabled.
+         Thanks to Pavel Rochnyak. #3225, #3230
+
 2019-06-13, Version 5.9.0
        * Build System: configure.ac: option "--with-libxml2" has been added.
          Thanks to Dimitrios Apostolou, Pavel Rochnyak. #2864
index ac072b0..a1ce009 100644 (file)
@@ -5771,7 +5771,7 @@ if test "x$with_libxmms" = "xyes"; then
 fi
 
 if test "x$with_libxmms" = "xyes"; then
-  SAVE_CPPFLAGS="$CFLAGS"
+  SAVE_CPPFLAGS="$CPPFLAGS"
   CPPFLAGS="$with_xmms_cflags"
 
   AC_CHECK_HEADER([xmmsctrl.h],
index cf2f811..8acf84b 100644 (file)
@@ -381,7 +381,7 @@ static bool check_send_notify_okay(const notification_t *n) /* {{{ */
         LOG_ERR, &complain_forwarding,
         "network plugin: A notification has been received via the network "
         "and forwarding is enabled. Forwarding of notifications is currently "
-        "not supported, because there is not loop-deteciton available. "
+        "not supported, because there is not loop-detection available. "
         "Please contact the collectd mailing list if you need this "
         "feature.");
   }
index 5c894c2..01c7c77 100644 (file)
@@ -724,7 +724,10 @@ static int get_block_stats(struct lv_block_stats *bstats,
       ERROR(PLUGIN_NAME " plugin: %s failed: %s", (s), err->message);          \
   } while (0)
 
-static char *metadata_get_hostname(virDomainPtr dom) {
+enum metadata_set_type_e { META_APPEND_HOST, META_APPEND_PLUGIN_INSTANCE };
+
+static void set_field_from_metadata(value_list_t *vl, virDomainPtr dom,
+                                    enum metadata_set_type_e field) {
   const char *xpath_str = NULL;
   if (hm_xpath == NULL)
     xpath_str = "/instance/name/text()";
@@ -742,10 +745,10 @@ static char *metadata_get_hostname(virDomainPtr dom) {
   char *metadata_str = virDomainGetMetadata(
       dom, VIR_DOMAIN_METADATA_ELEMENT, namespace, VIR_DOMAIN_AFFECT_CURRENT);
   if (metadata_str == NULL) {
-    return NULL;
+    return;
   }
 
-  char *hostname = NULL;
+  const char *value = NULL;
   xmlXPathContextPtr xpath_ctx = NULL;
   xmlXPathObjectPtr xpath_obj = NULL;
   xmlNodePtr xml_node = NULL;
@@ -789,18 +792,25 @@ static char *metadata_get_hostname(virDomainPtr dom) {
 
   xml_node = xpath_obj->nodesetval->nodeTab[0];
   if (xml_node->type == XML_TEXT_NODE) {
-    hostname = strdup((const char *)xml_node->content);
+    value = (const char *)xml_node->content;
   } else if (xml_node->type == XML_ATTRIBUTE_NODE) {
-    hostname = strdup((const char *)xml_node->children->content);
+    value = (const char *)xml_node->children->content;
   } else {
     ERROR(PLUGIN_NAME " plugin: xmlXPathEval(%s) unsupported node type %d",
           xpath_str, xml_node->type);
     goto metadata_end;
   }
 
-  if (hostname == NULL) {
-    ERROR(PLUGIN_NAME " plugin: strdup(%s) hostname failed", xpath_str);
+  if (value == NULL)
     goto metadata_end;
+
+  switch (field) {
+  case META_APPEND_HOST:
+    SSTRNCAT(vl->host, value, sizeof(vl->host));
+    break;
+  case META_APPEND_PLUGIN_INSTANCE:
+    SSTRNCAT(vl->plugin_instance, value, sizeof(vl->plugin_instance));
+    break;
   }
 
 metadata_end:
@@ -811,7 +821,6 @@ metadata_end:
   if (xml_doc)
     xmlFreeDoc(xml_doc);
   sfree(metadata_str);
-  return hostname;
 }
 
 static void init_value_list(value_list_t *vl, virDomainPtr dom) {
@@ -846,9 +855,7 @@ static void init_value_list(value_list_t *vl, virDomainPtr dom) {
         SSTRNCAT(vl->host, uuid, sizeof(vl->host));
       break;
     case hf_metadata:
-      name = metadata_get_hostname(dom);
-      if (name)
-        SSTRNCAT(vl->host, name, sizeof(vl->host));
+      set_field_from_metadata(vl, dom, META_APPEND_HOST);
       break;
     }
   }
@@ -874,13 +881,10 @@ static void init_value_list(value_list_t *vl, virDomainPtr dom) {
         SSTRNCAT(vl->plugin_instance, uuid, sizeof(vl->plugin_instance));
       break;
     case plginst_metadata:
-      name = metadata_get_hostname(dom);
-      if (name)
-        SSTRNCAT(vl->plugin_instance, name, sizeof(vl->plugin_instance));
+      set_field_from_metadata(vl, dom, META_APPEND_PLUGIN_INSTANCE);
       break;
     }
   }
-
 } /* void init_value_list */
 
 static int init_notif(notification_t *notif, const virDomainPtr domain,