Merge branch 'collectd-4.5'
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Thu, 16 Oct 2008 20:14:28 +0000 (22:14 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Thu, 16 Oct 2008 20:14:28 +0000 (22:14 +0200)
ChangeLog
contrib/collection.cgi
contrib/exec-munin.px
src/Makefile.am
src/collectd.conf.in
src/collectd.h
src/perl.c
src/postgresql.c
src/types.db
src/utils_tail.c

index 00a04ad..474f56f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        * thermal plugin: The new thermal plugin collects system temperatures
          using Linux ACPI thermal zone data.
 
+2008-10-16, Version 4.4.4
+       * build system: Change `--enable-<plugin>' to abort with an error if
+         dependencies are not met. Thanks to Bruno PrĂ©mont for the patch.
+         Also, the poisoning of various string functions has been restricted
+         to debug builds.
+       * collectd: Fix a memory leak in the global value cache. With every
+         *missing* value a couple of bytes would be leaked. Another memory
+         leak in the configuration handling code has been fixed. Thanks to
+         Niraj Tolia for reporting these issues.
+       * collectd: Fix an off-by-one error in the ignorelist functionality.
+         When using regular expressions, the last character would be missing,
+         possibly matching differently from what one would expect.
+       * collectdmon: Don't block SIGCHLD. This fixes a potential portability
+         problem.
+       * collectd-nagios: Fix handling of the `-d' option. Thanks to Fabian
+         Linzberger for reporting the but.
+       * network plugin: Fix a memory leak in the configuration handling
+         code. Thanks to Niraj Tolia for reporting this issue.
+       * perl plugin: Log an error message if bootstrapping `Collectd' fails.
+       * tail plugin: Call `clearerr' after reading an EOF. This fixes
+         problems with some `libc's. Thanks to Matthias Lay for reporting the
+         bug.
+
 2008-09-01, Version 4.4.3
        * collectd: Fix a memory leak in the threshold checking code.
        * memcached plugin: Fix a too short timeout and a related file
index fb4947d..7de8bcc 100755 (executable)
@@ -1016,6 +1016,18 @@ sub load_graph_definitions
     'GPRINT:max:MAX:%5.1lf%sAh Max,',
     'GPRINT:avg:LAST:%5.1lf%sAh Last\l'
     ],
+    connections => ['-v', 'Connections',
+    'DEF:avg={file}:value:AVERAGE',
+    'DEF:min={file}:value:MIN',
+    'DEF:max={file}:value:MAX',
+    "AREA:max#$HalfBlue",
+    "AREA:min#$Canvas",
+    "LINE1:avg#$FullBlue:Connections",
+    'GPRINT:min:MIN:%4.1lf Min,',
+    'GPRINT:avg:AVERAGE:%4.1lf Avg,',
+    'GPRINT:max:MAX:%4.1lf Max,',
+    'GPRINT:avg:LAST:%4.1lf Last\l'
+    ],
     cpu => ['-v', 'CPU load',
     'DEF:avg={file}:value:AVERAGE',
     'DEF:min={file}:value:MIN',
index 2460956..223a8a5 100755 (executable)
@@ -30,8 +30,7 @@ our $Interval = 300;
 main ();
 exit (0);
 
-# Configuration
-# {{{
+# Configuration {{{
 
 =head1 CONFIGURATION
 
index b9b7ab8..b20d700 100644 (file)
@@ -133,7 +133,7 @@ ascent_la_LDFLAGS = -module -avoid-version
 ascent_la_CFLAGS = $(AM_CFLAGS) \
                $(BUILD_WITH_LIBCURL_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS)
 ascent_la_LIBADD = $(BUILD_WITH_LIBCURL_LIBS) $(BUILD_WITH_LIBXML2_LIBS)
-collectd_LDADD += "-dlopen" apache.la
+collectd_LDADD += "-dlopen" ascent.la
 collectd_DEPENDENCIES += ascent.la
 endif
 
@@ -839,5 +839,6 @@ install-exec-hook:
                $(INSTALL) -m 0640 collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf; \
        fi; \
        cp -f $(srcdir)/types.db $(DESTDIR)$(pkglibdir)/;
-       $(INSTALL) -D -m 0644 $(srcdir)/postgresql_default.conf \
+       $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+       $(INSTALL) -m 0644 $(srcdir)/postgresql_default.conf \
                $(DESTDIR)$(pkgdatadir)/postgresql_default.conf;
index 53abd3f..0597273 100644 (file)
@@ -284,6 +284,11 @@ FQDNLookup   true
 #      BaseName "Collectd::Plugin"
 #      EnableDebugger ""
 #      LoadPlugin foo
+#
+#      <Plugin foo>
+#              Foo "Bar"
+#              Qux "Baz"
+#      </Plugin>
 #</Plugin>
 
 #<Plugin ping>
index 196530f..6fed900 100644 (file)
 # define __attribute__(x) /**/
 #endif
 
-#if __GNUC__
+#if defined(COLLECT_DEBUG) && COLLECT_DEBUG && defined(__GNUC__) && __GNUC__
 # pragma GCC poison strcpy strcat strtok
 #endif
 
  * included.
  */
 #ifndef DONT_POISON_SPRINTF_YET
-# if __GNUC__
+# if defined(COLLECT_DEBUG) && COLLECT_DEBUG && defined(__GNUC__) && __GNUC__
 #  pragma GCC poison sprintf
 # endif
 #endif
index d3e8c29..d9e1e00 100644 (file)
@@ -36,7 +36,7 @@
 #include <EXTERN.h>
 #include <perl.h>
 
-#if __GNUC__
+#if defined(COLLECT_DEBUG) && COLLECT_DEBUG && defined(__GNUC__) && __GNUC__
 # pragma GCC poison sprintf
 #endif
 
index 43f5af5..a5bacf4 100644 (file)
@@ -243,6 +243,7 @@ static c_psql_database_t *c_psql_database_new (const char *name)
 static void c_psql_database_delete (c_psql_database_t *db)
 {
        PQfinish (db->conn);
+       db->conn = NULL;
 
        sfree (db->queries);
        db->queries_num = 0;
@@ -416,14 +417,17 @@ static int c_psql_exec_query (c_psql_database_t *db, int idx)
        }
 
        rows = PQntuples (res);
-       if (1 > rows)
+       if (1 > rows) {
+               PQclear (res);
                return 0;
+       }
 
        cols = PQnfields (res);
        if (query->cols_num != cols) {
                log_err ("SQL query returned wrong number of fields "
                                "(expected: %i, got: %i)", query->cols_num, cols);
                log_info ("SQL query was: %s", query->query);
+               PQclear (res);
                return -1;
        }
 
@@ -441,6 +445,7 @@ static int c_psql_exec_query (c_psql_database_t *db, int idx)
                                submit_gauge (db, col.type, col.type_instance, value);
                }
        }
+       PQclear (res);
        return 0;
 } /* c_psql_exec_query */
 
@@ -545,6 +550,12 @@ static int c_psql_init (void)
 
                int j;
 
+               /* this will happen during reinitialization */
+               if (NULL != db->conn) {
+                       c_psql_check_connection (db);
+                       continue;
+               }
+
                status = ssnprintf (buf, buf_len, "dbname = '%s'", db->database);
                if (0 < status) {
                        buf     += status;
index 21d15d6..67d8f0d 100644 (file)
@@ -86,6 +86,7 @@ serial_octets         rx:COUNTER:0:4294967295, tx:COUNTER:0:4294967295
 signal_noise           value:GAUGE:U:0
 signal_power           value:GAUGE:U:0
 signal_quality         value:GAUGE:0:U
+spam_check             value:GAUGE:0:U
 spam_score             value:GAUGE:U:U
 swap                   value:GAUGE:0:1099511627776
 tcp_connections                value:GAUGE:0:4294967295
index eaf8f73..904a521 100644 (file)
@@ -162,6 +162,7 @@ int cu_tail_readline (cu_tail_t *obj, char *buf, int buflen)
 
   /* Try to read from the filehandle. If that succeeds, everything appears to
    * be fine and we can return. */
+  clearerr (obj->fh);
   if (fgets (buf, buflen, obj->fh) != NULL)
   {
     buf[buflen - 1] = 0;