Merge branch 'collectd-5.1' into collectd-5.2
authorFlorian Forster <octo@collectd.org>
Fri, 25 Jan 2013 22:05:30 +0000 (23:05 +0100)
committerFlorian Forster <octo@collectd.org>
Fri, 25 Jan 2013 22:05:30 +0000 (23:05 +0100)
Conflicts:
ChangeLog
src/write_graphite.c
version-gen.sh

ChangeLog
bindings/Makefile.am
bindings/perl/uninstall_mod.pl [new file with mode: 0644]
clean.sh
configure.in
src/Makefile.am
src/utils_complain.c
src/utils_complain.h
src/utils_dns.c
src/write_graphite.c

index d7dcbdf..6f0ae54 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        * tcpconns plugin: Use a netlink socket rather than reading from /proc
          for improved performance. Thanks to Michael Stapelberg for the patch.
 
+2013-01-25, Version 5.1.2
+       * Build system: "make distcheck" has been fixed. Thanks to Yves
+         Mettier for his patches.
+       * collectd: The complaint mechanism was fixed. It reported messages
+         more frequently than intended.
+       * dns plugin: Build issues on FreeBSD have been fixed. Thanks to
+         Ed Schouten for his patch.
+       * ethstat plugin: Fix the "Map" config option. An incorrectly used
+         character pointer may lead to a segmentation fault.
+       * network plugin: Build issues on FreeBSD have been fixed. Thanks to
+         Ed Schouten for his patch.
+       * varnish plugin: Fix a problem with instances without name.
+       * write_graphite: Improve reporting of connection errors to not spam
+         log files too much. Thanks to Pierre-Yves Ritschard for reporting
+         this problem.
+       * zfs_arc plugin: Fix the type used for mutex misses. Thanks to Yves
+         Mettier for reporting this bug.
+
 2012-11-11, Version 5.1.1
        * collectd: Create new directories with mode 0777 and let umask remove
          unwanted permission bits.
index 3876cc2..50cd727 100644 (file)
@@ -5,6 +5,7 @@ SUBDIRS += java
 endif
 
 EXTRA_DIST = perl/Makefile.PL \
+            perl/uninstall_mod.pl \
             perl/lib/Collectd.pm \
             perl/lib/Collectd/Unixsock.pm \
             perl/lib/Collectd/Plugins/Monitorus.pm \
@@ -33,12 +34,8 @@ install-exec-local:
 # Perl 'make uninstall' does not work as well as wanted.
 # So we do the work here.
 uninstall-local:
-       rm -f $(DESTDIR)$(mandir)/man3/Collectd::Unixsock.3pm
-       rm -f $(DESTDIR)$(datarootdir)/perl5/Collectd.pm
-       rm -f $(DESTDIR)$(datarootdir)/perl5/Collectd/Plugins/OpenVZ.pm
-       rm -f $(DESTDIR)$(datarootdir)/perl5/Collectd/Unixsock.pm
-       rm -f $(DESTDIR)$(prefix)/lib64/perl5/perllocal.pod
-       rm -f $(DESTDIR)$(prefix)/lib64/perl5/auto/Collectd/.packlist
+       @PERL@ -I$(DESTDIR)$(prefix) $(srcdir)/perl/uninstall_mod.pl Collectd
+       find $(DESTDIR)$(prefix) -name "perllocal.pod" -exec rm {} \;
 
 clean-local:
        rm -rf buildperl
@@ -48,7 +45,7 @@ perl: buildperl/Makefile
 
 buildperl/Makefile: .perl-directory-stamp buildperl/Makefile.PL \
        $(top_builddir)/config.status
-       cd buildperl && @PERL@ Makefile.PL INSTALL_BASE=$(prefix) @PERL_BINDINGS_OPTIONS@
+       cd buildperl && @PERL@ Makefile.PL INSTALL_BASE=$(DESTDIR)$(prefix) @PERL_BINDINGS_OPTIONS@
 
 buildperl/Makefile.PL: .perl-directory-stamp $(top_builddir)/config.status
 
diff --git a/bindings/perl/uninstall_mod.pl b/bindings/perl/uninstall_mod.pl
new file mode 100644 (file)
index 0000000..f8083af
--- /dev/null
@@ -0,0 +1,8 @@
+#! /usr/bin/perl
+
+use strict;
+use ExtUtils::Installed;
+
+my $mod = $ARGV[0] || die "Usage : $0 Module\n";
+my $inst = ExtUtils::Installed->new();
+unlink $inst->files($mod), $inst->packlist($mod)->packlist_file();
index 098669d..9defb05 100755 (executable)
--- a/clean.sh
+++ b/clean.sh
@@ -47,4 +47,6 @@ true \
 && rm -f -r src/libcollectdclient/.libs \
 && rm -f src/libcollectdclient/*.o \
 && rm -f src/libcollectdclient/*.la \
-&& rm -f src/libcollectdclient/*.lo
+&& rm -f src/libcollectdclient/*.lo \
+&& rm -f bindings/.perl-directory-stamp \
+&& rm -f -r bindings/buildperl
index 98395ed..d50e802 100644 (file)
@@ -24,7 +24,7 @@ m4_ifdef([LT_PACKAGE_VERSION],
        ]
 )
 
-AM_INIT_AUTOMAKE(dist-bzip2)
+AM_INIT_AUTOMAKE([tar-pax dist-bzip2])
 AC_LANG(C)
 
 AC_PREFIX_DEFAULT("/opt/collectd")
index 73e2df3..45fd9f9 100644 (file)
@@ -1415,7 +1415,7 @@ EXTRA_DIST +=   collectd.conf.pod \
        fi
 
 pinba.pb-c.c pinba.pb-c.h: pinba.proto
-       protoc-c --c_out . pinba.proto
+       protoc-c -I$(srcdir) --c_out . $(srcdir)/pinba.proto
 
 install-exec-hook:
        $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
index 328a6ab..c3752bc 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * collectd - src/utils_complain.c
- * Copyright (C) 2006-2007  Florian octo Forster
+ * Copyright (C) 2006-2013  Florian octo Forster
  * Copyright (C) 2008  Sebastian tokkee Harl
  *
  * This program is free software; you can redistribute it and/or modify it
 static int vcomplain (int level, c_complain_t *c,
                const char *format, va_list ap)
 {
-       time_t now;
+       cdtime_t now;
        char   message[512];
 
-       now = time (NULL);
+       now = cdtime ();
 
        if (c->last + c->interval > now)
                return 0;
@@ -44,8 +44,8 @@ static int vcomplain (int level, c_complain_t *c,
        else
                c->interval *= 2;
 
-       if (c->interval > 86400)
-               c->interval = 86400;
+       if (c->interval > TIME_T_TO_CDTIME_T (86400))
+               c->interval = TIME_T_TO_CDTIME_T (86400);
 
        vsnprintf (message, sizeof (message), format, ap);
        message[sizeof (message) - 1] = '\0';
@@ -58,12 +58,9 @@ void c_complain (int level, c_complain_t *c, const char *format, ...)
 {
        va_list ap;
 
-       /* reset the old interval */
-       if (c->interval < 0)
-               c->interval *= -1;
-
        va_start (ap, format);
-       vcomplain (level, c, format, ap);
+       if (vcomplain (level, c, format, ap))
+               c->complained_once = 1;
        va_end (ap);
 } /* c_complain */
 
@@ -71,12 +68,12 @@ void c_complain_once (int level, c_complain_t *c, const char *format, ...)
 {
        va_list ap;
 
-       if (c->interval < 0)
+       if (c->complained_once)
                return;
 
        va_start (ap, format);
        if (vcomplain (level, c, format, ap))
-               c->interval *= -1;
+               c->complained_once = 1;
        va_end (ap);
 } /* c_complain_once */
 
@@ -89,6 +86,7 @@ void c_do_release (int level, c_complain_t *c, const char *format, ...)
                return;
 
        c->interval = 0;
+       c->complained_once = 0;
 
        va_start (ap, format);
        vsnprintf (message, sizeof (message), format, ap);
index 09c4375..028dda6 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * collectd - src/utils_complain.h
- * Copyright (C) 2006-2007  Florian octo Forster
+ * Copyright (C) 2006-2013  Florian octo Forster
  * Copyright (C) 2008  Sebastian tokkee Harl
  *
  * This program is free software; you can redistribute it and/or modify it
 #ifndef UTILS_COMPLAIN_H
 #define UTILS_COMPLAIN_H 1
 
-#include <time.h>
+#include "utils_time.h"
 
 typedef struct
 {
        /* time of the last report */
-       time_t last;
+       cdtime_t last;
 
-       /* how long to wait until reporting again
-        *   0 indicates that the complaint is no longer valid
-        * < 0 indicates that the complaint has been reported once
-        *     => c_complain_once will not report again
-        *     => c_complain uses the absolute value to reset the old value */
-       int interval;
+       /* How long to wait until reporting again.
+        * 0 indicates that the complaint is no longer valid. */
+       cdtime_t interval;
+
+       _Bool complained_once;
 } c_complain_t;
 
-#define C_COMPLAIN_INIT_STATIC { 0, 0 }
-#define C_COMPLAIN_INIT(c) do { (c)->last = 0; (c)->interval = 0; } while (0)
+#define C_COMPLAIN_INIT_STATIC { 0, 0, 0 }
+#define C_COMPLAIN_INIT(c) do { \
+       (c)->last = 0; \
+       (c)->interval = 0; \
+       (c)->complained_once = 0; \
+} while (0)
 
 /*
  * NAME
index 80a2ee5..655c61e 100644 (file)
 #include "plugin.h"
 #include "common.h"
 
-#if HAVE_NETINET_IN_SYSTM_H
-# include <netinet/in_systm.h>
-#endif
-#if HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-#if HAVE_NETINET_IP6_H
-# include <netinet/ip6.h>
-#endif
-#if HAVE_NETINET_IP_COMPAT_H
-# include <netinet/ip_compat.h>
-#endif
-#if HAVE_ARPA_INET_H
-# include <arpa/inet.h>
-#endif
 #if HAVE_SYS_SOCKET_H
 # include <sys/socket.h>
 #endif
 
-#if HAVE_ARPA_NAMESER_H
-# include <arpa/nameser.h>
-#endif
-#if HAVE_ARPA_NAMESER_COMPAT_H
-# include <arpa/nameser_compat.h>
-#endif
-
 #if HAVE_NET_IF_ARP_H
 # include <net/if_arp.h>
 #endif
 #if HAVE_NET_IF_H
 # include <net/if.h>
 #endif
-#if HAVE_NETINET_IF_ETHER_H
-# include <netinet/if_ether.h>
-#endif
 #if HAVE_NET_PPP_DEFS_H
 # include <net/ppp_defs.h>
 #endif
 # include <net/if_ppp.h>
 #endif
 
-#if HAVE_NETDB_H
-# include <netdb.h>
+#if HAVE_NETINET_IN_SYSTM_H
+# include <netinet/in_systm.h>
+#endif
+#if HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+#if HAVE_NETINET_IP6_H
+# include <netinet/ip6.h>
+#endif
+#if HAVE_NETINET_IP_COMPAT_H
+# include <netinet/ip_compat.h>
+#endif
+#if HAVE_NETINET_IF_ETHER_H
+# include <netinet/if_ether.h>
 #endif
-
 #if HAVE_NETINET_IP_H
 # include <netinet/ip.h>
 #endif
 #ifdef HAVE_NETINET_IP_VAR_H
 # include <netinet/ip_var.h>
 #endif
-#if HAVE_NETINET_IP6_H
-# include <netinet/ip6.h>
-#endif
 #if HAVE_NETINET_UDP_H
 # include <netinet/udp.h>
 #endif
 
+#if HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
+#if HAVE_ARPA_NAMESER_H
+# include <arpa/nameser.h>
+#endif
+#if HAVE_ARPA_NAMESER_COMPAT_H
+# include <arpa/nameser_compat.h>
+#endif
+
+#if HAVE_NETDB_H
+# include <netdb.h>
+#endif
+
 #if HAVE_PCAP_H
 # include <pcap.h>
 #endif
index 735283f..87befb6 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2011       Scott Sanders
  * Copyright (C) 2009       Paul Sadauskas
  * Copyright (C) 2009       Doug MacEachern
- * Copyright (C) 2007-2012  Florian octo Forster
+ * Copyright (C) 2007-2013  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
@@ -46,6 +46,7 @@
 #include "configfile.h"
 
 #include "utils_cache.h"
+#include "utils_complain.h"
 #include "utils_parse_option.h"
 #include "utils_format_graphite.h"
 
@@ -93,6 +94,7 @@ struct wg_callback
     cdtime_t send_buf_init_time;
 
     pthread_mutex_t send_lock;
+    c_complain_t init_complaint;
 };
 
 
@@ -214,12 +216,19 @@ static int wg_callback_init (struct wg_callback *cb)
     if (cb->sock_fd < 0)
     {
         char errbuf[1024];
-        ERROR ("write_graphite plugin: Connecting to %s:%s failed. "
+        c_complain (LOG_ERR, &cb->init_complaint,
+                "write_graphite plugin: Connecting to %s:%s failed. "
                 "The last error was: %s", node, service,
                 sstrerror (errno, errbuf, sizeof (errbuf)));
         close (cb->sock_fd);
         return (-1);
     }
+    else
+    {
+        c_release (LOG_INFO, &cb->init_complaint,
+                "write_graphite plugin: Successfully connected to %s:%s.",
+                node, service);
+    }
 
     wg_reset_buffer (cb);
 
@@ -271,7 +280,7 @@ static int wg_flush (cdtime_t timeout,
         status = wg_callback_init (cb);
         if (status != 0)
         {
-            ERROR ("write_graphite plugin: wg_callback_init failed.");
+            /* An error message has already been printed. */
             pthread_mutex_unlock (&cb->send_lock);
             return (-1);
         }
@@ -297,7 +306,7 @@ static int wg_send_message (char const *message, struct wg_callback *cb)
         status = wg_callback_init (cb);
         if (status != 0)
         {
-            ERROR ("write_graphite plugin: wg_callback_init failed.");
+            /* An error message has already been printed. */
             pthread_mutex_unlock (&cb->send_lock);
             return (-1);
         }
@@ -354,11 +363,11 @@ static int wg_write_messages (const data_set_t *ds, const value_list_t *vl,
     if (status != 0) /* error message has been printed already. */
         return (status);
 
+    /* Send the message to graphite */
     wg_send_message (buffer, cb);
     if (status != 0)
     {
-        ERROR ("write_graphite plugin: wg_send_message failed "
-                "with status %i.", status);
+        /* An error message has already been printed. */
         return (status);
     }
 
@@ -435,6 +444,7 @@ static int wg_config_carbon (oconfig_item_t *ci)
     cb->format_flags = GRAPHITE_STORE_RATES;
 
     pthread_mutex_init (&cb->send_lock, /* attr = */ NULL);
+    C_COMPLAIN_INIT (&cb->init_complaint);
 
     for (i = 0; i < ci->children_num; i++)
     {