Code

Merge branch 'collectd-5.4' into collectd-5.5
authorMarc Fournier <marc.fournier@camptocamp.com>
Tue, 12 Jan 2016 08:03:09 +0000 (09:03 +0100)
committerMarc Fournier <marc.fournier@camptocamp.com>
Tue, 12 Jan 2016 08:03:09 +0000 (09:03 +0100)
src/collectd.conf.in
src/collectd.conf.pod
src/curl_json.c
src/email.c
src/libcollectdclient/network.c
src/netapp.c
src/openvpn.c
src/perl.c
src/snmp.c

index 729aa032d0caa2bd4df5711acd2b4af0b50a4839..689677c96236a665598f4306e9d03d18bf72123a 100644 (file)
 
 #<Plugin iptables>
 #      Chain table chain
+#      Chain6 table chain
 #</Plugin>
 
 #<Plugin irq>
index ba700a98ab3e62ce004022e0918e01ae1f10c89c..42ade4ee7fe6c50f60ca8876c02473a780a1d7e6 100644 (file)
@@ -2553,9 +2553,13 @@ a notification is sent.
 
 =item B<Chain> I<Table> I<Chain> [I<Comment|Number> [I<Name>]]
 
-Select the rules to count. If only I<Table> and I<Chain> are given, this plugin
-will collect the counters of all rules which have a comment-match. The comment
-is then used as type-instance.
+=item B<Chain6> I<Table> I<Chain> [I<Comment|Number> [I<Name>]]
+
+Select the iptables/ip6tables filter rules to count packets and bytes from.
+
+If only I<Table> and I<Chain> are given, this plugin will collect the counters
+of all rules which have a comment-match. The comment is then used as
+type-instance.
 
 If I<Comment> or I<Number> is given, only the rule with the matching comment or
 the I<n>th rule will be collected. Again, the comment (or the number) will be
index 98ba0bb2ed9db58462fe465a6f8dbe902c17e6ae..448db15eed78d91f34028b39d6577ea3048b914e 100644 (file)
@@ -132,17 +132,11 @@ static size_t cj_curl_callback (void *buf, /* {{{ */
     return (len);
 #endif
 
-  if (status != yajl_status_ok)
-  {
-    unsigned char *msg =
-      yajl_get_error(db->yajl, /* verbose = */ 1,
-          /* jsonText = */ (unsigned char *) buf, (unsigned int) len);
-    ERROR ("curl_json plugin: yajl_parse failed: %s", msg);
-    yajl_free_error(db->yajl, msg);
-    return (0); /* abort write callback */
-  }
-
-  return (len);
+  unsigned char *msg = yajl_get_error(db->yajl, /* verbose = */ 1,
+        /* jsonText = */ (unsigned char *) buf, (unsigned int) len);
+  ERROR ("curl_json plugin: yajl_parse failed: %s", msg);
+  yajl_free_error(db->yajl, msg);
+  return (0); /* abort write callback */
 } /* }}} size_t cj_curl_callback */
 
 static int cj_get_type (cj_key_t *key)
index f5dcf7090fa37f53737aa7bd559aecf98fdf65e7..6a0c0a45718e7b167a5e179f028b40a6eb1cce06 100644 (file)
@@ -539,7 +539,7 @@ static void *open_connection (void __attribute__((unused)) *arg)
                }
 
                connection = malloc (sizeof (*connection));
-               if (connection != NULL)
+               if (connection == NULL)
                {
                        close (remote);
                        continue;
index a3b8fdfa0cfa63cd45cddfa70bc633573a541321..420471df577eb28aece3cc3770fca73ffce2faec 100644 (file)
@@ -89,6 +89,7 @@ static int server_close_socket (lcc_server_t *srv) /* {{{ */
     return (0);
 
   close (srv->fd);
+  srv->fd = -1;
   free (srv->sa);
   srv->sa = NULL;
   srv->sa_len = 0;
@@ -107,12 +108,6 @@ static void int_server_destroy (lcc_server_t *srv) /* {{{ */
 
   next = srv->next;
 
-  if (srv->fd >= 0)
-  {
-    close (srv->fd);
-    srv->fd = -1;
-  }
-
   free (srv->node);
   free (srv->service);
   free (srv->username);
index f446d597de1f27610b0be1c7e2cfde8957509a79..f761e290dfb509432f24fa6a2b5f6e517c2e5963 100644 (file)
@@ -1524,7 +1524,7 @@ static int cna_change_volume_status (const char *hostname, /* {{{ */
 {
        notification_t n;
 
-       memset (&n, 0, sizeof (&n));
+       memset (&n, 0, sizeof (n));
        n.time = cdtime ();
        sstrncpy (n.host, hostname, sizeof (n.host));
        sstrncpy (n.plugin, "netapp", sizeof (n.plugin));
index 663a82d8fd9221fd6b138361efb03b340dc3666f..93c8f1b58363fbf8f7a27f4f03a5b4077f74fee8 100644 (file)
@@ -697,6 +697,14 @@ static int openvpn_config (const char *key, const char *value)
 
                /* create a new vpn element since file, version and name are ok */
                temp = (vpn_status_t *) malloc (sizeof (vpn_status_t));
+               if (temp == NULL)
+               {
+                       char errbuf[1024];
+                       ERROR ("openvpn plugin: malloc failed: %s",
+                                       sstrerror (errno, errbuf, sizeof (errbuf)));
+                       sfree (status_file);
+                       return (1);
+               }
                temp->file = status_file;
                temp->version = status_version;
                temp->name = status_name;
@@ -705,7 +713,7 @@ static int openvpn_config (const char *key, const char *value)
                if (vpn_list == NULL)
                {
                        char errbuf[1024];
-                       ERROR ("openvpn plugin: malloc failed: %s",
+                       ERROR ("openvpn plugin: realloc failed: %s",
                                        sstrerror (errno, errbuf, sizeof (errbuf)));
 
                        sfree (temp->file);
index 0a166a1ba184754782e6fd57de370e3eb57247ca..3b498f9b7ea348caf5048bc27932ccf3e0deb714 100644 (file)
@@ -1208,7 +1208,10 @@ static void c_ithread_destructor (void *arg)
 
        /* the ithread no longer exists */
        if (NULL == t)
+       {
+               pthread_mutex_unlock (&perl_threads->mutex);
                return;
+       }
 
        c_ithread_destroy (ithread);
 
index cf7d975e4b858663f04f0f847e4c7dd7778d1f3f..ae41d03ae8562781a5ba0f7ec1ff155666f63795 100644 (file)
@@ -1379,7 +1379,7 @@ static int csnmp_dispatch_table (host_definition_t *host, data_definition_t *dat
 static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
 {
   struct snmp_pdu *req;
-  struct snmp_pdu *res;
+  struct snmp_pdu *res = NULL;
   struct variable_list *vb;
 
   const data_set_t *ds;