Merge branch 'collectd-4.4' into collectd-4.5
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sat, 8 Nov 2008 07:59:17 +0000 (08:59 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sat, 8 Nov 2008 07:59:17 +0000 (08:59 +0100)
ChangeLog
configure.in
contrib/collection3/bin/graph.cgi
src/apcups.c
src/configfile.c
src/libiptc/libip6tc.c
src/mysql.c
src/utils_dns.c

index 7783a9c..74a06cb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        * 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.
+         Linzberger for reporting the bug.
        * 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
+       * tail plugin: Call `clearerr(3)' after reading an EOF. This fixes
          problems with some `libc's. Thanks to Matthias Lay for reporting the
          bug.
 
index c71cfa4..0aa87ff 100644 (file)
@@ -1359,12 +1359,24 @@ then
 
        if test $mysql_config_status -ne 0
        then
-               with_libmysql="no"
+               with_libmysql="no ($with_mysql_config failed)"
        else
                SAVE_CPPFLAGS="$CPPFLAGS"
                CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
 
-               AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
+               have_mysql_h="no"
+               have_mysql_mysql_h="no"
+               AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
+
+               if test "x$have_mysql_h" = "xno"
+               then
+                       AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
+               fi
+
+               if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
+               then
+                       with_libmysql="no (mysql.h not found)"
+               fi
 
                CPPFLAGS="$SAVE_CPPFLAGS"
        fi
@@ -1376,7 +1388,7 @@ then
 
        if test $mysql_config_status -ne 0
        then
-               with_libmysql="no"
+               with_libmysql="no ($with_mysql_config failed)"
        else
                AC_CHECK_LIB(mysqlclient, mysql_init,
                 [with_libmysql="yes"],
index 1524a66..7fe2087 100755 (executable)
@@ -20,6 +20,23 @@ our $Debug = param ('debug');
 our $Begin = param ('begin');
 our $End = param ('end');
 our $GraphWidth = param ('width');
+our $OutputFormat = 'PNG';
+our $ContentType = 'image/png';
+
+if (param ('format'))
+{
+  my $temp = param ('format') || '';
+  $temp = uc ($temp);
+
+  if ($temp =~ m/^(PNG|SVG|EPS|PDF)$/)
+  {
+    $OutputFormat = $temp;
+
+    if ($OutputFormat eq 'SVG') { $ContentType = 'image/svg+xml'; }
+    elsif ($OutputFormat eq 'EPS') { $ContentType = 'image/eps'; }
+    elsif ($OutputFormat eq 'PDF') { $ContentType = 'application/pdf'; }
+  }
+}
 
 if ($Debug)
 {
@@ -141,7 +158,7 @@ flush_files ($files,
     addr => gc_get_scalar ('UnixSockAddr', undef),
     interval => gc_get_scalar ('Interval', 10));
 
-print STDOUT header (-Content_type => 'image/png',
+print STDOUT header (-Content_type => $ContentType,
   -Last_Modified => epoch_to_rfc1123 ($obj->getLastModified ()),
   -Expires => epoch_to_rfc1123 ($expires));
 
@@ -173,7 +190,7 @@ else
   }
 
   $| = 1;
-  RRDs::graph ('-', '-a', 'PNG', '--width', $GraphWidth, @timesel, @$args);
+  RRDs::graph ('-', '-a', $OutputFormat, '--width', $GraphWidth, @timesel, @$args);
   if (my $err = RRDs::error ())
   {
     print STDERR "RRDs::graph failed: $err\n";
index 227c703..ca026b9 100644 (file)
  *   Anthony Gialluca <tonyabg at charter.net>
  **/
 
-/*
- * FIXME: Don't know why but without this here atof() was not returning
- * correct values for me. This is behavior that I don't understand and
- * should be examined in closer detail.
- */
-#include <stdlib.h>
-
 #include "collectd.h"
 #include "common.h"      /* rrd_update_file */
 #include "plugin.h"      /* plugin_register, plugin_submit */
index 9609086..b1030fe 100644 (file)
@@ -276,7 +276,7 @@ static int dispatch_value_plugin (const char *plugin, oconfig_item_t *ci)
        buffer_ptr = buffer + 1;
 
        return (cf_dispatch (plugin, ci->key, buffer_ptr));
-} /* int plugin_conf_dispatch */
+} /* int dispatch_value_plugin */
 
 static int dispatch_value (const oconfig_item_t *ci)
 {
index b30bb28..276b7af 100644 (file)
@@ -131,7 +131,7 @@ typedef unsigned int socklen_t;
 #include "libiptc.c"
 
 #define BIT6(a, l) \
- ((ntohl(a->in6_u.u6_addr32[(l) / 32]) >> (31 - ((l) & 31))) & 1)
+ ((ntohl(a->s6_addr32[(l) / 32]) >> (31 - ((l) & 31))) & 1)
 
 int
 ipv6_prefix_length(const struct in6_addr *a)
index 312a819..4e72b5b 100644 (file)
@@ -24,7 +24,9 @@
 #include "plugin.h"
 #include "configfile.h"
 
-#ifdef HAVE_MYSQL_MYSQL_H
+#ifdef HAVE_MYSQL_H
+#include <mysql.h>
+#elif defined(HAVE_MYSQL_MYSQL_H)
 #include <mysql/mysql.h>
 #endif
 
index f2ab337..c16ca52 100644 (file)
@@ -391,7 +391,7 @@ handle_dns(const char *buf, int len,
     while ((t = strchr(qh.qname, '\r')))
        *t = ' ';
     for (t = qh.qname; *t; t++)
-       *t = tolower(*t);
+       *t = tolower((int) *t);
 
     memcpy(&us, buf + offset, 2);
     qh.qtype = ntohs(us);