Merge branch 'collectd-5.4'
authorMarc Fournier <marc.fournier@camptocamp.com>
Wed, 7 Jan 2015 23:18:57 +0000 (00:18 +0100)
committerMarc Fournier <marc.fournier@camptocamp.com>
Wed, 7 Jan 2015 23:18:57 +0000 (00:18 +0100)
15 files changed:
configure.ac
contrib/redhat/collectd.spec
contrib/redhat/init.d-collectd
src/collectd.conf.in
src/cpu.c
src/daemon/types_list.c
src/libcollectdclient/client.c
src/netlink.c
src/pyvalues.c
src/utils_cmd_flush.c
src/utils_cmd_getval.c
src/utils_cmd_listval.c
src/utils_cmd_putnotif.c
src/utils_cmd_putval.c
src/virt.c

index bf11ae9..21003f2 100644 (file)
@@ -1964,7 +1964,7 @@ then
                [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
 
        if test "$with_libgcrypt" != "no"; then
-               AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
+               m4_ifdef([AM_PATH_LIBGCRYPT],[AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")])
                GCRYPT_CPPFLAGS="$LIBGCRYPT_CPPFLAGS $LIBGCRYPT_CFLAGS"
                GCRYPT_LIBS="$LIBGCRYPT_LIBS"
        fi
index 29efd75..6507d5f 100644 (file)
@@ -213,7 +213,7 @@ Source:             http://collectd.org/files/%{name}-%{version}.tar.bz2
 License:       GPLv2
 Group:         System Environment/Daemons
 BuildRoot:     %{_tmppath}/%{name}-%{version}-root
-BuildRequires: libgcrypt-devel, kernel-headers
+BuildRequires: libgcrypt-devel, kernel-headers, libtool-ltdl-devel
 Vendor:                collectd development team <collectd@verplant.org>
 
 Requires(post):                chkconfig
@@ -1676,6 +1676,8 @@ find %{buildroot} -type f -name .packlist -delete
 find %{buildroot} -type f -name perllocal.pod -delete
 
 %if ! %{with_java}
+rm -f %{buildroot}%{_datadir}/collectd/java/collectd-api.jar
+rm -f %{buildroot}%{_datadir}/collectd/java/generic-jmx.jar
 rm -f %{buildroot}%{_mandir}/man5/collectd-java.5*
 %endif
 
@@ -1686,6 +1688,10 @@ rm -fr perl-examples/
 rm -fr %{buildroot}/usr/lib/perl5/
 %endif
 
+%if ! %{with_postgresql}
+rm -f %{buildroot}%{_datadir}/collectd/postgresql_default.conf
+%endif
+
 %if ! %{with_python}
 rm -f %{buildroot}%{_mandir}/man5/collectd-python.5*
 %endif
@@ -1725,7 +1731,7 @@ fi
 %{_bindir}/collectd-tg
 %{_bindir}/collectdctl
 %{_sbindir}/collectdmon
-%{_datadir}/collectd/
+%{_datadir}/collectd/types.db
 %{_sharedstatedir}/collectd
 %{_mandir}/man1/collectd-nagios.1*
 %{_mandir}/man1/collectd.1*
@@ -2027,8 +2033,8 @@ fi
 
 %if %{with_java}
 %files java
-%{_prefix}/share/collectd/java/collectd-api.jar
-%{_prefix}/share/collectd/java/generic-jmx.jar
+%{_datadir}/collectd/java/collectd-api.jar
+%{_datadir}/collectd/java/generic-jmx.jar
 %{_libdir}/%{name}/java.so
 %{_mandir}/man5/collectd-java.5*
 %endif
@@ -2120,7 +2126,7 @@ fi
 
 %if %{with_postgresql}
 %files postgresql
-%{_prefix}/share/collectd/postgresql_default.conf
+%{_datadir}/collectd/postgresql_default.conf
 %{_libdir}/%{name}/postgresql.so
 %endif
 
index 4c69f3c..829eda5 100644 (file)
@@ -42,7 +42,6 @@ check_config() {
         return 0
 }
 
-
 start () {
        echo -n $"Starting collectd: "
        check_config
@@ -58,6 +57,7 @@ start () {
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$service
        fi
 }
+
 stop () {
        echo -n $"Stopping collectd: "
        killproc -p $COLLECTDMONPID -d $MAXWAIT $prog
@@ -65,6 +65,20 @@ stop () {
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$service
 }
+
+restart () {
+       check_config
+       rc="$?"
+       if test "$rc" -ne 0; then
+               RETVAL=6
+               echo $"not restarting due to configuration error"
+               failure $"not restarting $service due to configuration error"
+       else
+               stop
+               start
+       fi
+}
+
 # See how we were called.
 case "$1" in
   start)
@@ -77,16 +91,7 @@ case "$1" in
        status -p $COLLECTDMONPID $prog
        ;;
   restart|reload)
-       check_config
-       rc="$?"
-       if test "$rc" -ne 0; then
-               RETVAL=6
-               echo $"not restarting due to configuration error"
-               failure $"not restarting $service due to configuration error"
-       else
-               stop
-               start
-       fi
+       restart
        ;;
   condrestart)
        [ -f /var/lock/subsys/$service ] && restart || :
index dcb1a7a..95734c2 100644 (file)
 #              Interface "eth0"
 #              ResolveInterval 14400
 @LOAD_PLUGIN_NETWORK@  </Server>
-#      TimeToLive "128"
+#      TimeToLive 128
 #
 #      # server setup:
 #      Listen "ff18::efc0:4a42" "25826"
index 8d9c0a6..57af2dd 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
@@ -231,8 +231,6 @@ static int init (void)
 
        DEBUG ("host_processors returned %i %s", (int) cpu_list_len, cpu_list_len == 1 ? "processor" : "processors");
        INFO ("cpu plugin: Found %i processor%s.", (int) cpu_list_len, cpu_list_len == 1 ? "" : "s");
-
-       cpu_temp_retry_max = 86400 / CDTIME_T_TO_TIME_T (plugin_get_interval ());
 /* #endif PROCESSOR_CPU_LOAD_INFO */
 
 #elif defined(HAVE_LIBKSTAT)
index b3cb8cf..c0e61c5 100644 (file)
@@ -164,7 +164,7 @@ static void parse_file (FILE *fh)
       continue;
 
     while ((buf_len > 0) && ((buf[buf_len - 1] == '\n')
-         || (buf[buf_len - 1] == '\n')))
+         || (buf[buf_len - 1] == '\r')))
       buf[--buf_len] = '\0';
 
     if (buf_len == 0)
index 20015be..9ad61f6 100644 (file)
@@ -258,6 +258,7 @@ static int lcc_send (lcc_connection_t *c, const char *command) /* {{{ */
     lcc_set_errno (c, errno);
     return (-1);
   }
+  fflush(c->fh);
 
   return (0);
 } /* }}} int lcc_send */
index de2de9b..aa9760f 100644 (file)
@@ -780,7 +780,7 @@ static int ir_read (void)
         continue;
       }
 
-      DEBUG ("netlink plugin: ir_read: querying %s from %s (%lu).",
+      DEBUG ("netlink plugin: ir_read: querying %s from %s (%zu).",
           type_name[type_index], iflist[ifindex], ifindex);
 
       nlh = mnl_nlmsg_put_header (buf);
index 4f5c4ce..78e6cf9 100644 (file)
@@ -427,10 +427,11 @@ static meta_data_t *cpy_build_meta(PyObject *meta) {
                cpy_log_exception("building meta data");
                return NULL;
        }
-
        s = PyList_Size(l);
-       if (s < 0)
+       if (s <= 0) {
+               Py_XDECREF(l);
                return NULL;
+       }
 
        m = meta_data_create();
        for (i = 0; i < s; ++i) {
index 30da630..089ab70 100644 (file)
 #include "utils_parse_option.h"
 
 #define print_to_socket(fh, ...) \
-       if (fprintf (fh, __VA_ARGS__) < 0) { \
-               char errbuf[1024]; \
-               WARNING ("handle_flush: failed to write to socket #%i: %s", \
-                               fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
-               return -1; \
-       }
+       do { \
+               if (fprintf (fh, __VA_ARGS__) < 0) { \
+                       char errbuf[1024]; \
+                       WARNING ("handle_flush: failed to write to socket #%i: %s", \
+                                       fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
+                       return -1; \
+               } \
+               fflush(fh); \
+       } while (0)
 
 static int add_to_array (char ***array, int *array_num, char *value)
 {
index 354c553..196b45e 100644 (file)
 #include "utils_parse_option.h"
 
 #define print_to_socket(fh, ...) \
-  if (fprintf (fh, __VA_ARGS__) < 0) { \
-    char errbuf[1024]; \
-    WARNING ("handle_getval: failed to write to socket #%i: %s", \
-       fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
-    return -1; \
-  }
+  do { \
+    if (fprintf (fh, __VA_ARGS__) < 0) { \
+      char errbuf[1024]; \
+      WARNING ("handle_getval: failed to write to socket #%i: %s", \
+          fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
+      return -1; \
+    } \
+    fflush(fh); \
+  } while (0)
 
 int handle_getval (FILE *fh, char *buffer)
 {
index d9dc5c1..b698388 100644 (file)
   } while (0)
 
 #define print_to_socket(fh, ...) \
-  if (fprintf (fh, __VA_ARGS__) < 0) { \
-    char errbuf[1024]; \
-    WARNING ("handle_listval: failed to write to socket #%i: %s", \
-       fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
-    free_everything_and_return (-1); \
-  }
+  do { \
+    if (fprintf (fh, __VA_ARGS__) < 0) { \
+      char errbuf[1024]; \
+      WARNING ("handle_listval: failed to write to socket #%i: %s", \
+          fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
+      free_everything_and_return (-1); \
+    } \
+    fflush(fh); \
+  } while (0)
 
 int handle_listval (FILE *fh, char *buffer)
 {
index e14a258..530d153 100644 (file)
 #include "utils_parse_option.h"
 
 #define print_to_socket(fh, ...) \
-  if (fprintf (fh, __VA_ARGS__) < 0) { \
-    char errbuf[1024]; \
-    WARNING ("handle_putnotif: failed to write to socket #%i: %s", \
-       fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
-    return -1; \
-  }
+  do { \
+    if (fprintf (fh, __VA_ARGS__) < 0) { \
+      char errbuf[1024]; \
+      WARNING ("handle_putnotif: failed to write to socket #%i: %s", \
+          fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
+      return -1; \
+    } \
+    fflush(fh); \
+  } while (0)
 
 static int set_option_severity (notification_t *n, const char *value)
 {
index 366b413..c717f0b 100644 (file)
 #include "utils_parse_option.h"
 
 #define print_to_socket(fh, ...) \
-       if (fprintf (fh, __VA_ARGS__) < 0) { \
-               char errbuf[1024]; \
-               WARNING ("handle_putval: failed to write to socket #%i: %s", \
-                               fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
-               return -1; \
-       }
+    do { \
+        if (fprintf (fh, __VA_ARGS__) < 0) { \
+            char errbuf[1024]; \
+            WARNING ("handle_putval: failed to write to socket #%i: %s", \
+                    fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
+            return -1; \
+        } \
+        fflush(fh); \
+    } while (0)
 
 static int dispatch_values (const data_set_t *ds, value_list_t *vl,
                FILE *fh, char *buffer)
index 5f87625..b6fedf5 100644 (file)
@@ -547,6 +547,12 @@ lv_read (void)
             continue;
         }
 
+        if (info.state != VIR_DOMAIN_RUNNING)
+        {
+            /* only gather stats for running domains */
+            continue;
+        }
+
         cpu_submit (info.cpuTime, domains[i], "virt_cpu_total");
         memory_submit ((gauge_t) info.memory * 1024, domains[i]);