Merge branch 'collectd-4.8' into collectd-4.9
authorFlorian Forster <octo@huhu.verplant.org>
Thu, 25 Feb 2010 22:55:25 +0000 (23:55 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Thu, 25 Feb 2010 22:55:25 +0000 (23:55 +0100)
Conflicts:

src/ping.c

28 files changed:
bindings/java/Makefile.am
configure.in
contrib/collection.cgi
contrib/exec-munin.px
debian/README.Debian [deleted file]
debian/changelog [deleted file]
debian/collectd.conf [deleted file]
debian/collectd.init.d [deleted file]
debian/collectd.postrm [deleted file]
debian/compat [deleted file]
debian/control [deleted file]
debian/copyright [deleted file]
debian/examples/myplugin.c [deleted file]
debian/rules [deleted file]
src/apache.c
src/collectd-perl.pod
src/collectd.conf.in
src/collectd.conf.pod
src/collectd.h
src/exec.c
src/filter_chain.c
src/mysql.c
src/ping.c
src/plugin.c
src/postgresql.c
src/utils_cmd_listval.c
src/utils_format_json.c
src/write_http.c

index d3315ac..fa253f6 100644 (file)
@@ -27,19 +27,22 @@ EXTRA_DIST = org/collectd/api/CollectdConfigInterface.java \
 java-build-stamp: org/collectd/api/*.java
        $(JAVAC) -d "." "$(srcdir)/org/collectd/api"/*.java
        $(JAVAC) -d "." "$(srcdir)/org/collectd/java"/*.java
+       mkdir -p .libs
+       $(JAR) cf .libs/collectd-api.jar "org/collectd/api"/*.class
+       $(JAR) cf .libs/generic-jmx.jar "org/collectd/java"/*.class
        touch "$@"
 
 all-local: java-build-stamp
 
 install-exec-local: java-build-stamp
-       mkdir -p "$(DESTDIR)$(pkgdatadir)/java/org/collectd/api"
-       $(INSTALL) -m 644 "org/collectd/api"/*.class \
-               "$(DESTDIR)$(pkgdatadir)/java/org/collectd/api/"
-       mkdir -p "$(DESTDIR)$(pkgdatadir)/java/org/collectd/java"
-       $(INSTALL) -m 644 "org/collectd/java"/*.class \
-               "$(DESTDIR)$(pkgdatadir)/java/org/collectd/java/"
+       mkdir -p "$(DESTDIR)$(pkgdatadir)/java"
+       $(INSTALL) -m 644 .libs/collectd-api.jar \
+               "$(DESTDIR)$(pkgdatadir)/java"
+       $(INSTALL) -m 644 .libs/generic-jmx.jar \
+               "$(DESTDIR)$(pkgdatadir)/java"
 
 clean-local:
        rm -f "org/collectd/api"/*.class
        rm -f "org/collectd/java"/*.class
+       rm -f .libs
        rm -f "java-build-stamp"
index 8d0744a..b3a7dcc 100644 (file)
@@ -1611,6 +1611,7 @@ with_java_vmtype="client"
 with_java_cflags=""
 with_java_libs=""
 JAVAC="$JAVAC"
+JAR="$JAR"
 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
 [
        if test "x$withval" = "xno"
@@ -1671,6 +1672,18 @@ then
                                AC_MSG_RESULT([not found])
                        fi
                fi
+               if test "x$JAR" = "x"
+               then
+                       AC_MSG_CHECKING([for jar])
+                       TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
+                       if test "x$TMPDIR" != "x"
+                       then
+                               JAR="$TMPDIR"
+                               AC_MSG_RESULT([$JAR])
+                       else
+                               AC_MSG_RESULT([not found])
+                       fi
+               fi
        else if test "x$with_java_home" != "x"
        then
                AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
@@ -1707,6 +1720,24 @@ if test "x$JAVAC" = "x"
 then
        with_java="no (javac not found)"
 fi
+if test "x$JAR" = "x"
+then
+       with_jar_path="$PATH"
+       if test "x$with_java_home" != "x"
+       then
+               with_jar_path="$with_java_home:$with_jar_path"
+               if test -d "$with_java_home/bin"
+               then
+                       with_jar_path="$with_java_home/bin:$with_jar_path"
+               fi
+       fi
+
+       AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
+fi
+if test "x$JAR" = "x"
+then
+       with_java="no (jar not found)"
+fi
 
 SAVE_CPPFLAGS="$CPPFLAGS"
 SAVE_CFLAGS="$CFLAGS"
index cbdb76e..100c0c7 100755 (executable)
@@ -13,6 +13,7 @@ use Data::Dumper ();
 
 our $Config = "/etc/collection.conf";
 our @DataDirs = ();
+our @DontShowTypes = ();
 our $LibDir;
 
 our $ValidTimespan =
@@ -78,6 +79,10 @@ sub read_config
                        $value =~ s#/*$##;
                        $LibDir = $value;
                }
+               elsif ($key eq 'dontshowtype')
+               {
+                 push (@DontShowTypes, $value);
+               }
                else
                {
                        print STDERR "Unknown key: $key\n";
@@ -239,6 +244,7 @@ sub _find_types
       my $name = "$_";
       $name =~ s/\.rrd$//i;
       my ($type, $instance) = split (m/-/, $name, 2);
+      if (grep { $_ eq $type } @DontShowTypes) { next; }
       $types{$type} = [] if (!$types{$type});
       push (@{$types{$type}}, $instance) if (defined ($instance));
     }
index 9163730..907ea9b 100755 (executable)
@@ -1,5 +1,26 @@
 #!/usr/bin/perl
 
+#
+# collectd - contrib/exec-munin.px
+# Copyright (C) 2007,2008  Florian 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
+# Free Software Foundation; only version 2 of the License is applicable.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+#
+# Authors:
+#   Florian octo Forster <octo at verplant.org>
+#
+
 use strict;
 use warnings;
 
diff --git a/debian/README.Debian b/debian/README.Debian
deleted file mode 100644 (file)
index b0b701b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-collectd on Debian
-==================
-
-General notes:
---------------
-
-- This package is split up into several packages to prevent you from having to
-  install dependencies (or recommended packages) that you don't actually need.
-  Any plugin that has dependencies other than libc gets its own package.
-
-Configuring collectd:
----------------------
-
-- collectd uses a similar configuration layout as openvpn does. That is to
-  say that one daemon process is started for each configuration file found in
-  /etc/collectd/.
-
-- See collectd.conf(5) for details about configuring collectd.
-
-Building your own plugins:
---------------------------
-
-- If you want to contribute plugins to the official distribution you should
-  read http://collectd.org/dev-info.shtml.
-
-- If you want to build plugins for your personal use only simply install the
-  collectd-dev package and use /usr/share/doc/collectd-dev/examples/myplugin.c
-  as a starting point (Note: This is already a working example, though it does
-  not collect any useful data).
-  
-  The resulting file can be compiled as follows:
-
-    gcc -shared -o myplugin.so myplugin.c
-
-  Copy myplugin.so to /usr/lib/collectd and add the following line to your
-  collectd config file:
-
-    LoadPlugin myplugin
-
-  Restart collectd and you're done.
-
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644 (file)
index 14e450b..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-collectd (3.11.5-0octo1) unstable; urgency=low
-
-  * New upstream release.
-
- -- Florian Forster <octo@leeloo.home.verplant.org>  Tue, 29 May 2007 22:50:59 +0200
-
-collectd (3.11.4-0octo1) unstable; urgency=low
-
-  * New upstream release.
-
- -- Florian Forster <octo@leeloo.home.verplant.org>  Tue, 10 Apr 2007 17:18:11 +0200
-
-collectd (3.11.3-0octo1) unstable; urgency=low
-
-  * New upstream release.
-
- -- Florian octo Forster <octo@alice.lan.home.verplant.org>  Fri, 30 Mar 2007 22:08:40 +0200
-
-collectd (3.11.0-0octo1) unstable; urgency=low
-
-  * New upstream release.
-  * The package collectd-mbmon has been added.
-
- -- Florian octo Forster <octo@alice.lan.home.verplant.org>  Fri, 22 Dec 2006 15:10:37 +0100
-
-collectd (3.10.4-0octo1) unstable; urgency=low
-
-  * New upstream release.
-
- -- Florian Forster <octo@leeloo.home.verplant.org>  Thu, 21 Dec 2006 20:36:37 +0100
-
-collectd (3.10.3-0octo1) unstable; urgency=low
-
-  * New upstream release.
-
- -- Florian Forster <octo@leeloo.home.verplant.org>  Sat,  4 Nov 2006 13:46:49 +0100
-
-collectd (3.10.1-4) unstable; urgency=low
-
-  * Changed collectd-dbg's section and priority to "devel" and "extra"
-    respectively.
-  * Set init start sequence code to 95 to be sure to start after any daemons
-    that data is collected from.
-
- -- Sebastian Harl <sh@tokkee.org>  Thu,  5 Oct 2006 10:25:07 +0000
-
-collectd (3.10.1-3) unstable; urgency=low
-
-  * Added --oknodo to start-stop-daemon in the init script (Closes: #379703).
-
- -- Sebastian Harl <sh@tokkee.org>  Tue, 25 Jul 2006 18:34:55 +0200
-
-collectd (3.10.1-2) unstable; urgency=low
-
-  * Added collectd-dbg package.
-
- -- Sebastian Harl <sh@tokkee.org>  Sun, 23 Jul 2006 23:39:42 +0200
-
-collectd (3.10.1-1) unstable; urgency=low
-
-  * New upstream release.
-  * Dynamically link against external liboping.
-    - New binary package collectd-ping.
-    - Added collectd-ping to suggested packages.
-  * Moved config file from /usr/share/doc/collectd/examples/ to
-    /etc/collectd/.
-
- -- Sebastian Harl <sh@tokkee.org>  Sat, 22 Jul 2006 21:43:37 +0200
-
-collectd (3.10.0-1) unstable; urgency=low
-
-  * New upstream release.
-    New plugins:
-    - APC UPS's charge, load, input/output/battery voltage, etc.: apcups
-    - NTP daemon's local clock drift, offset to peers, etc.: ntpd
-  * Upstream no longer provides a debian/ directory. Thus no repackaging is
-    required any longer.
-  * Not using getifaddrs() is now the default in upstream. getifaddrs.dpatch
-    no longer needed.
-  * Added collectd-hddtemp as a suggestion to the collectd package.
-
- -- Sebastian Harl <sh@tokkee.org>  Sun,  9 Jul 2006 21:52:13 +0200
-
-collectd (3.9.4+debian-1) unstable; urgency=low
-
-  * Initial release (Closes: #373008).
-  * Removed upstream's debian/ directory from .orig.tar.gz.
-  * getifaddrs.dpatch: Patching src/traffic.c to read data from /proc instead
-    of using getifaddrs(). getifaddrs() does not seem to work correctly on 
-    AMD64.
-
- -- Sebastian Harl <sh@tokkee.org>  Fri,  7 Jul 2006 15:49:42 +0200
-
diff --git a/debian/collectd.conf b/debian/collectd.conf
deleted file mode 100644 (file)
index 91eef47..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-# Config file for collectd(1).
-#
-# Some plugins need additional configuration and are disabled by default.
-# Please read collectd.conf(5) for details.
-
-Mode Local
-
-# If in "Client" mode you have to specify which server to send datagrams to.
-#Mode Client
-#Server 123.123.123.123 12345
-
-#Mode Server
-
-#Mode Log
-
-#DataDir    /var/lib/collectd
-#PIDFILE    /var/run/collectd.pid
-#PluginDir  /usr/lib/collectd
-
-#LoadPlugin apache
-#LoadPlugin apcups
-#LoadPlugin apple_sensors
-LoadPlugin battery
-LoadPlugin cpu
-#LoadPlugin cpufreq
-LoadPlugin df
-LoadPlugin disk
-#LoadPlugin hddtemp
-LoadPlugin load
-#LoadPlugin mbmon
-LoadPlugin memory
-#LoadPlugin mysql
-#LoadPlugin nfs
-#LoadPlugin ntpd
-#LoadPlugin ping
-LoadPlugin processes
-#LoadPlugin sensors
-#LoadPlugin serial
-LoadPlugin swap
-#LoadPlugin tape
-LoadPlugin traffic
-LoadPlugin users
-#LoadPlugin vserver
-#LoadPlugin wireless
-
-#<Plugin apache>
-#   URL http://localhost/status?auto
-#   User www-user
-#   Password secret
-#   CACert /etc/ssl/ca.crt
-#</Plugin>
-
-#<Plugin apcups>
-#   Host localhost
-#   Port 3551
-#</Plugin>
-
-#<Plugin hddtemp>
-#   Host 127.0.0.1
-#   Port 7634
-#</Plugin>
-
-#<Plugin mbmon>
-#      Host 127.0.0.1
-#      Port 411
-#</Plugin>
-
-#<Plugin ntpd>
-#   Host localhost
-#   Port 123
-#</Plugin>
-
-#<Plugin mysql>
-#   Host localhost
-#   User db_user
-#   Password secret
-#   Database db_name
-#</Plugin>
-
-#<Plugin ping>
-#   Host host.foo.bar
-#   Host host.baz.qux
-#</Plugin>
-
-#<Plugin traffic>
-#   Interface eth0
-#   IgnoreSelected false
-#</Plugin>
-
diff --git a/debian/collectd.init.d b/debian/collectd.init.d
deleted file mode 100755 (executable)
index 7c8ac29..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/bin/bash
-#
-# collectd     Initscript for collectd
-#              http://collectd.org/
-# Authors:     Florian Forster <octo@verplant.org>
-#              Sebastian Harl <sh@tokkee.org>
-#
-
-set -e
-
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-DESC="Statistics collection daemon"
-NAME=collectd
-DAEMON=/usr/sbin/$NAME
-SCRIPTNAME=/etc/init.d/$NAME
-ARGS=""
-
-CONFIGDIR=/etc/collectd
-# for backward compatibility
-FALLBACKCONF=/etc/collectd.conf
-
-# Gracefully exit if the package has been removed.
-test -x $DAEMON || exit 0
-
-if [ -r /etc/default/$NAME ]
-then
-       . /etc/default/$NAME
-fi
-
-#
-#      Function that starts the daemon/service.
-#
-d_start() {
-       i=0
-       
-       if [ ! -d "$CONFIGDIR" ]
-       then
-               if [ -e "$FALLBACKCONF" ]
-               then
-                       $DAEMON -C "$FALLBACKCONF" 2> /dev/null
-               else
-                       echo ""
-                       echo "This package is not configured yet. Please refer"
-                       echo "to /usr/share/doc/collectd/README.Debian for"
-                       echo "details."
-                       echo ""
-                       exit 0
-               fi
-       else
-               for FILE in `ls $CONFIGDIR/*.conf 2>/dev/null`
-               do
-                       NAME=`basename "$FILE" .conf`
-
-                       if [ $i == 0 ]
-                       then
-                               echo -n " ("
-                       else
-                               echo -n ", "
-                       fi
-                       
-                       $DAEMON -C "$FILE" 2> /dev/null
-                       if [ $? == 0 ]
-                       then
-                               echo -n "$NAME"
-                       else
-                               echo -n "$NAME failed"
-                       fi
-
-                       i=$(($i+1))
-               done
-
-               if [ $i == 0 ]
-               then
-                       echo -n "[no config found]"
-                       exit 1
-               else
-                       echo -n ")"
-               fi
-       fi
-}
-
-#
-#      Function that stops the daemon/service.
-#
-d_stop() {
-       start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
-}
-
-case "$1" in
-  start)
-       echo -n "Starting $DESC: $NAME"
-       d_start
-       echo "."
-       ;;
-  stop)
-       echo -n "Stopping $DESC: $NAME"
-       d_stop
-       echo "."
-       ;;
-  restart|force-reload)
-       echo -n "Restarting $DESC: $NAME"
-       d_stop
-       sleep 1
-       d_start
-       echo "."
-       ;;
-  *)
-       echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
-       exit 1
-       ;;
-esac
-
-exit 0
-
-# vim: syntax=sh noexpandtab sw=8 ts=8 :
diff --git a/debian/collectd.postrm b/debian/collectd.postrm
deleted file mode 100755 (executable)
index 84b8386..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-# postrm script for collectd
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postrm> `remove'
-#        * <postrm> `purge'
-#        * <old-postrm> `upgrade' <new-version>
-#        * <new-postrm> `failed-upgrade' <old-version>
-#        * <new-postrm> `abort-install'
-#        * <new-postrm> `abort-install' <old-version>
-#        * <new-postrm> `abort-upgrade' <old-version>
-#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
-    purge)
-        rm -rf /var/lib/collectd
-        rm -rf /etc/collectd
-        ;;
-    
-    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-        ;;
-
-    *)
-        echo "postrm called with unknown argument \`$1'" >&2
-        exit 1
-        ;;
-
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
diff --git a/debian/compat b/debian/compat
deleted file mode 100644 (file)
index 7ed6ff8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-5
diff --git a/debian/control b/debian/control
deleted file mode 100644 (file)
index 56e8463..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-Source: collectd
-Section: utils
-Priority: optional
-Maintainer: Sebastian Harl <sh@tokkee.org>
-Build-Depends: debhelper (>= 5), autotools-dev, libcurl3-dev,
- libmysqlclient15-dev | libmysqlclient14-dev, librrd2-dev | librrd0-dev,
- libsensors-dev, liboping-dev (> 0.3.3)
-Standards-Version: 3.7.2
-
-Package: collectd
-Architecture: any
-Depends: ${shlibs:Depends}
-Suggests: collectd-apache, collectd-mysql, collectd-sensors, collectd-dev,
- collectd-hddtemp, collectd-mbmon, collectd-ping, librrds-perl
-Description: statistics collection daemon
- collectd is a small daemon written in C for performance. It reads various
- system statistics and updates RRD files, creating them if necessary. Since
- the daemon doesn't need to startup every time it wants to update the files
- it's very fast and easy on the system. Also, the statistics are very fine
- grained since the files are updated every 10 seconds.
- .
- This package contains the main program file and the following plugins:
-   * APC UPS's charge, load, input/output/battery voltage, etc.: apcups
-   * Apple computer's sensors information: apple_sensors (server mode only)
-   * battery status: battery
-   * CPU utilization: cpu
-   * CPU frequency: cpufreq
-   * disk space usage: df
-   * disk and partition throughput: disk
-   * system load averages: load
-   * memory usage: memory
-   * NFS utilization: nfs
-   * NTP daemon's local clock drift, offset to peers, etc.: ntpd
-   * number of processes: processes
-   * serial port traffic: serial
-   * swap usage: swap
-   * tape drive usage: tape (server mode only)
-   * network traffic: traffic
-   * number of users logged into the system: users
-   * system ressources used by Linux-VServers: vserver
-   * wireless network stats: wireless
-
-Package: collectd-dbg
-Section: devel
-Architecture: any
-Priority: extra
-Depends: collectd (= ${Source-Version}), collectd-apache (= ${Source-Version}),
- collectd-hddtemp (= ${Source-Version}), collectd-mysql (= ${Source-Version}),
- collectd-ping (= ${Source-Version}), collectd-sensors (= ${Source-Version})
-Description: statistics collection daemon (debugging symbols)
- collectd is a small daemon written in C for performance. It reads various
- system statistics and updates RRD files, creating them if necessary. Since
- the daemon doesn't need to startup every time it wants to update the files
- it's very fast and easy on the system. Also, the statistics are very fine
- grained since the files are updated every 10 seconds.
- .
- This package contains the debugging symbols.
-
-Package: collectd-apache
-Architecture: any
-Depends: collectd (= ${Source-Version}), ${shlibs:Depends}
-Description: statistics collection daemon (Apache plugin)
- collectd is a small daemon written in C for performance. It reads various
- system statistics and updates RRD files, creating them if necessary. Since
- the daemon doesn't need to startup every time it wants to update the files
- it's very fast and easy on the system. Also, the statistics are very fine
- grained since the files are updated every 10 seconds.
- .
- This package contains the Apache plugin which collects Apache statistics
- provided by Apache's mod_status.
-
-Package: collectd-hddtemp
-Architecture: any
-Depends: collectd (= ${Source-Version}), ${shlibs:Depends}
-Recommends: hddtemp
-Description: statistics collection daemon (hddtemp plugin)
- collectd is a small daemon written in C for performance. It reads various
- system statistics and updates RRD files, creating them if necessary. Since
- the daemon doesn't need to startup every time it wants to update the files
- it's very fast and easy on the system. Also, the statistics are very fine
- grained since the files are updated every 10 seconds.
- .
- This package contains the hddtemp plugin which collects harddisk temperatures.
-
-Package: collectd-mbmon
-Architecture: any
-Depends: collectd (= ${Source-Version}), ${shlibs:Depends}
-Recommends: mbmon (>= 2.01)
-Description: statistics collection daemon (mbmon plugin)
- collectd is a small daemon written in C for performance. It reads various
- system statistics and updates RRD files, creating them if necessary. Since
- the daemon doesn't need to startup every time it wants to update the files
- it's very fast and easy on the system. Also, the statistics are very fine
- grained since the files are updated every 10 seconds.
- .
- This package contains the mbmon plugin which collects motherboard status
- information: temperatures, voltages and cooling fan speeds.
-
-Package: collectd-mysql
-Architecture: any
-Depends: collectd (= ${Source-Version}), ${shlibs:Depends}
-Description: statistics collection daemon (MySQL plugin)
- collectd is a small daemon written in C for performance. It reads various
- system statistics and updates RRD files, creating them if necessary. Since
- the daemon doesn't need to startup every time it wants to update the files
- it's very fast and easy on the system. Also, the statistics are very fine
- grained since the files are updated every 10 seconds.
- .
- This package contains the MySQL plugin which collects MySQL statistics
- provided by MySQL's "show status" command.
-
-Package: collectd-ping
-Architecture: any
-Depends: collectd (= ${Source-Version}), ${shlibs:Depends}
-Description: statistics collection daemon (ping plugin)
- collectd is a small daemon written in C for performance. It reads various
- system statistics and updates RRD files, creating them if necessary. Since
- the daemon doesn't need to startup every time it wants to update the files
- it's very fast and easy on the system. Also, the statistics are very fine
- grained since the files are updated every 10 seconds.
- .
- This package contains the ping plugin which collects network latency
- statistics.
-
-Package: collectd-sensors
-Architecture: any
-Depends: collectd (= ${Source-Version}), ${shlibs:Depends}
-Description: statistics collection daemon (sensors plugin)
- collectd is a small daemon written in C for performance. It reads various
- system statistics and updates RRD files, creating them if necessary. Since
- the daemon doesn't need to startup every time it wants to update the files
- it's very fast and easy on the system. Also, the statistics are very fine
- grained since the files are updated every 10 seconds.
- .
- This package contains the sensors plugin which collects lm_sensors
- information (e.g. CPU temperature, fan speeds).
-
-Package: collectd-dev
-Architecture: all
-Depends: collectd (= ${Source-Version})
-Description: statistics collection daemon (development files)
- collectd is a small daemon written in C for performance. It reads various
- system statistics and updates RRD files, creating them if necessary. Since
- the daemon doesn't need to startup every time it wants to update the files
- it's very fast and easy on the system. Also, the statistics are very fine
- grained since the files are updated every 10 seconds.
- .
- This package contains the development files needed to create your own
- plugins.
diff --git a/debian/copyright b/debian/copyright
deleted file mode 100644 (file)
index c75c8ee..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-This package was debianized by Sebastian Harl <sh@tokkee.org> on
-Wed, 10 May 2006 09:20:39 +0200.
-
-It was downloaded from <http://collectd.org/files/>.
-
-Upstream Authors:
-       Core Developer:
-       Florian Forster <octo@verplant.org>
-
-       For individual credits, see AUTHORS.
-
-Copyright Holders (in alphabetical order):
-       Andre M. Hedrick <andre@suse.com>
-       Anthony Gialluca <tonyabg@charter.net>
-       David Bacher <drbacher@gmail.com>
-       Florian Forster <octo@verplant.org>
-       Free Software Foundation, Inc.
-       Jason Pepas <cell@ices.utexas.edu>
-       Kern Sibbald
-       Lyonel Vincent <lyonel@ezix.org>
-       Niki W. Waibel <niki.waibel@newlogic.com>
-       Peter Holik <peter@holik.at>
-       Roy Keene, Keene Enterprises <libconfig@rkeene.org>
-       Scott Garrett <sgarrett@technomancer.com>
-       Sebastian Harl <sh@tokkee.org>
-       Vincent Stehlé <vincent.stehle@free.fr>
-
-License:
-
-       Files src/apache.c
-             src/apple_sensors.c
-             src/mysql.c
-             src/ntpd.c
-             src/battery.c
-             src/wireless.c
-       Copyright (C) 2006 Florian Forster <octo@verplant.org>
-
-       File src/apcups.c
-       Copyright (C) 2006 Anthony Gialluca <tonyabg@charter.net>
-       Copyright (C) 2000-2004 Kern Sibbald
-       Copyright (C) 1996-99 Andre M. Hedrick <andre@suse.com>
-
-       File src/cpufreq.c
-       Copyright (C) 2005, 2006 Peter Holik <peter@holik.at>
-
-       File src/hddtemp.c
-       Copyright (C) 2005, 2006 Vincent Stehlé <vincent.stehle@free.fr>
-
-       File src/mbmon.c
-       Copyright (C) 2006 Flavio Stanchina <flavio@stanchina.net>
-
-       File src/nfs.c
-       Copyright (C) 2005, 2006 Jason Pepas <cell@ices.utexas.edu>
-
-       File src/processes.c
-       Copyright (C) 2005 Lyonel Vincent <lyonel@ezix.org>
-       Copyright (C) 2006 Florian Forster <octo@verplant.org> (Mach code)
-
-       File src/serial.c
-       Copyright (C) 2005, 2006 David Bacher <drbacher@gmail.com>
-
-       File src/tape.c
-       Copyright (C) 2005, 2006 Scott Garrett <sgarrett@technomancer.com>
-
-       File src/users.c
-       Copyright (C) 2005, 2006 Sebastian Harl <sh@tokkee.org>
-
-       Files src/utils_debug.c
-             src/utils_debug.h
-             src/utils_mount.c
-             src/utils_mount.h
-       Copyright (C) 2005, 2006 Niki W. Waibel <niki.waibel@gmx.net>
-
-       File src/vserver.c
-       Copyright (C) 2006 Sebastian Harl <sh@tokkee.org>
-
-       All other files (except libltdl/* and src/libconfig/*):
-       Copyright (C) 2005, 2006 Florian Forster <octo@verplant.org>
-
-       This package is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This package is distributed in the hope that it will be useful,
-       but WITHOUT ANY WARRANTY; without even the implied warranty of
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       GNU General Public License for more details.
-
-       You should have received a copy of the GNU General Public License
-       along with this package; if not, write to the Free Software
-       Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 
-       USA.
-
-On Debian systems, the complete text of the GNU General Public License 
-can be found in `/usr/share/common-licenses/GPL'.
-
-       File libltdl/ltdl.c
-       Copyright (C) 1998-2000, 2004, 2005 Free Software Foundation, Inc.
-       Originally by Thomas Tanner <tanner@ffii.org>
-
-       File libltdl/ltdl.h
-       Copyright (C) 1998-2000 Free Software Foundation, Inc.
-       Originally by Thomas Tanner <tanner@ffii.org>
-       
-       This library is free software; you can redistribute it and/or
-       modify it under the terms of the GNU Lesser General Public
-       License as published by the Free Software Foundation; either
-       version 2 of the License, or (at your option) any later version.
-
-       This library is distributed in the hope that it will be useful,
-       but WITHOUT ANY WARRANTY; without even the implied warranty of
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-       Lesser General Public License for more details.
-
-       You should have received a copy of the GNU Lesser General Public
-       License along with this library; if not, write to the Free Software
-       Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 
-       USA.
-
-On Debian systems, the complete text of the GNU Lesser General Public License 
-can be found in `/usr/share/common-licenses/LGPL'.
-
-       Files src/libconfig/*
-       Copyright (C) Roy Keene <libconfig@rkeene.org>
-
-       Permission is hereby granted, free of charge, to any person
-       obtaining a copy of this software and associated documentation 
-       files (the "Software"), to deal in the Software without restriction, 
-       including without limitation the rights to use, copy, modify, merge, 
-       publish, distribute, sublicense, and/or sell copies of the Software, 
-       and to permit persons to whom the Software is furnished to do so, 
-       subject to the following conditions:
-
-       The above copyright notice and this permission notice shall be 
-       included in all copies or substantial portions of the Software.
-
-       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
-       EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
-       MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
-       IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
-       CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
-       TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
-       SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-The Debian packaging is (C) 2006, Sebastian Harl <sh@tokkee.org> and
-is licensed under the GPL, see above.
-
diff --git a/debian/examples/myplugin.c b/debian/examples/myplugin.c
deleted file mode 100644 (file)
index 1bd8e42..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * /usr/share/doc/collectd/examples/sample_plugin.c
- *
- * A sample plugin for collectd.
- *
- * Written by Sebastian Harl <sh@tokkee.org>
- *
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free 
- * Software Foundation; either version 2 of the License, or (at your 
- * option) any later version.
- */
-
-#include <collectd/common.h>    /* rrd_update_file */
-#include <collectd/plugin.h>    /* plugin_* */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-/* Optional config file support */
-/* #include <collectd/configfile.h> */
-
-/* Optional debugging support 
- * (only available if collectd was compiled with debugging support) */
-/* #include <collectd/utils_debug.h> */
-
-#define MODULE_NAME "myplugin"
-
-/* Name of the rrd file under DataDir (/var/lib/collectd by default)
- *
- * The name may contain slashes to create subdirectories. */
-static char *my_rrd = "myplugin.rrd";
-
-/* DS definitions for the rrd file
- *
- * See the rrdcreate(1) manpage for details. The heartbeat is configurable in
- * collectd. It defaults to 25. */
-static char *ds_def[] =
-{
-    "DS:my_ds:GAUGE:25:0:U",
-    NULL
-};
-
-/* DS count */
-static int ds_num = 1;
-
-/* Time at which the read function is called */
-extern time_t curtime;
-
-/* Initialize the plugin
- *
- * This function is called to set up a plugin before using it. */
-static void my_init(void)
-{
-    /* we have nothing to do here :-) */
-    return;
-}
-
-/* Get the data
- *
- * This function implements the magic used to get the desired values that
- * should be stored in the rrd file. It uses plugin_submit to transfer the
- * data to whatever place is configured in the config file. If there are more
- * than one instances you should pass a uniq identifier as seconds argument to
- * the plugin_submit function. */
-#define BUFSIZE 256
-static void my_read(void)
-{
-    long int data = 0;
-    char buf[BUFSIZE] = "";
-
-    /* magic ;-) */
-    data = random();
-
-    if (snprintf(buf, BUFSIZE, "%u:%li", 
-                (unsigned int)curtime, data) >= BUFSIZE)
-        return;
-
-    plugin_submit(MODULE_NAME, NULL, buf);
-    return;
-}
-#undef BUFSIZE
-
-/* Save the data
- *
- * This function saves the data to the appropriate location by calling
- * rrd_update_file. It is used to "calculate" the filename and DS definition
- * appropriate for the given instance. */
-static void my_write(host, inst, val)
-    char *host;
-    char *inst;
-    char *val;
-{
-    rrd_update_file(host, my_rrd, val, ds_def, ds_num);
-    return;
-}
-
-/* Register the plugin
- *
- * This function registers the plugin with collectd. It has to be named
- * "module_register". */
-void module_register(void)
-{
-    plugin_register(MODULE_NAME, my_init, my_read, my_write);
-    return;
-}
-
diff --git a/debian/rules b/debian/rules
deleted file mode 100755 (executable)
index 602efd5..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/usr/bin/make -f
-# debian/rules for collectd
-#
-# Written by Sebastian Harl <sh@tokkee.org>.
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-# These are used for cross-compiling and for saving the configure script
-# from having to guess our platform (since we know it already)
-DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-
-CFLAGS = -Wall -g
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-       CFLAGS += -O0
-else
-       CFLAGS += -O2
-endif
-
-config.status: configure
-       dh_testdir
-       CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) \
-                       --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
-                       --mandir=\$${prefix}/share/man \
-                       --localstatedir=/var --sysconfdir=/etc
-
-build: build-stamp
-
-build-stamp: config.status
-       dh_testdir
-       
-       $(MAKE)
-       
-       touch build-stamp
-
-clean:
-       dh_testdir
-       dh_testroot
-       rm -f build-stamp
-       
-       -$(MAKE) distclean
-       
-       dh_clean 
-
-install-indep:
-       dh_testdir
-       dh_testroot
-       dh_clean -k
-       dh_installdirs -i
-       
-       include_dir=$(CURDIR)/debian/collectd-dev/usr/include/collectd/ \
-               && mkdir -p $$include_dir \
-               && cp src/*.h $$include_dir
-
-install-arch: build
-       dh_testdir
-       dh_testroot
-       dh_clean -k 
-       dh_installdirs -a
-       
-       $(MAKE) install DESTDIR=$(CURDIR)/debian/collectd
-       
-       rm -f $(CURDIR)/debian/collectd/usr/lib/collectd/*.la
-       
-       rm -f $(CURDIR)/debian/collectd/etc/collectd.conf
-       install -D -m 0644 $(CURDIR)/debian/collectd.conf \
-               $(CURDIR)/debian/collectd/etc/collectd/collectd.conf
-       
-       for PLUGIN in apache hddtemp mbmon mysql ping sensors; do \
-               plugin_dir=$(CURDIR)/debian/collectd-$$PLUGIN/usr/lib/collectd/; \
-               mkdir -p $$plugin_dir; \
-               mv $(CURDIR)/debian/collectd/usr/lib/collectd/$$PLUGIN.so \
-                       $$plugin_dir; \
-       done    
-
-binary-indep: install-indep
-       dh_testdir
-       dh_testroot
-       dh_installchangelogs -i ChangeLog
-       dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
-       dh_installexamples -i debian/examples/myplugin.c
-       dh_compress -i
-       dh_fixperms -i
-       dh_installdeb -i
-       dh_gencontrol -i
-       dh_md5sums -i
-       dh_builddeb -i
-
-binary-arch: build install-arch
-       dh_testdir
-       dh_testroot
-       dh_installchangelogs -a ChangeLog
-       dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
-       dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi
-       dh_installinit -a -- defaults 95
-       dh_installman -a src/collectd.1 src/collectd.conf.5
-       dh_link -a
-       dh_strip -a --dbg-package=collectd-dbg
-       dh_compress -a
-       dh_fixperms -a
-       dh_installdeb -a
-       dh_shlibdeps -a
-       dh_gencontrol -a
-       dh_md5sums -a
-       dh_builddeb -a
-
-binary: binary-arch binary-indep
-.PHONY: build clean binary-indep binary-arch binary install-indep install-arch
-
index d6712dc..ad877b5 100644 (file)
@@ -685,7 +685,8 @@ static int apache_read_host (user_data_t *user_data) /* {{{ */
                {
                        if (strcmp (fields[0], "Scoreboard:") == 0)
                                submit_scoreboard (fields[1], st);
-                       else if (strcmp (fields[0], "BusyServers:") == 0)
+                       else if ((strcmp (fields[0], "BusyServers:") == 0) /* Apache 1.* */
+                                       || (strcmp (fields[0], "BusyWorkers:") == 0) /* Apache 2.* */)
                                submit_gauge ("apache_connections", NULL, atol (fields[1]), st);
                }
        }
index b8d72f0..85e7a8a 100644 (file)
@@ -163,7 +163,7 @@ and collectd:
 
 =item Config-Item
 
-A config-item is one structure which keeps the informations provided in the
+A config-item is one structure which keeps the information provided in the
 configuration file. The array of children keeps one entry for each
 configuration option. Each such entry is another config-item structure, which
 may nest further if nested blocks are used.
index 049b07d..844c83b 100644 (file)
@@ -349,7 +349,7 @@ FQDNLookup   true
 
 #<Plugin "java">
 #      JVMArg "-verbose:jni"
-#      JVMArg "-Djava.class.path=@prefix@/share/collectd/java"
+#      JVMArg "-Djava.class.path=@prefix@/share/collectd/java/collectd-api.jar"
 #
 #      LoadPlugin "org.collectd.java.Foobar"
 #      <Plugin "org.collectd.java.Foobar">
index 74c54c5..33d4f35 100644 (file)
@@ -112,7 +112,7 @@ a value higher than the number of plugins you've loaded is totally useless.
 =item B<Hostname> I<Name>
 
 Sets the hostname that identifies a host. If you omit this setting, the
-hostname will be determinded using the L<gethostname(2)> system call.
+hostname will be determined using the L<gethostname(2)> system call.
 
 =item B<FQDNLookup> B<true|false>
 
@@ -443,7 +443,7 @@ The curl plugin uses the B<libcurl> (L<http://curl.haxx.se/>) to read web pages
 and the match infrastructure (the same code used by the tail plugin) to use
 regular expressions with the received data.
 
-The following example will read the current value of AMD stock from google's
+The following example will read the current value of AMD stock from Google's
 finance page and dispatch the value to collectd.
 
   <Plugin curl>
@@ -952,7 +952,7 @@ is set to B<true>, all disks are collected B<except> the ones matched.
 
 =item B<Interface> I<Interface>
 
-The dns plugin uses B<libpcap> to capture dns traffic and analyses it. This
+The dns plugin uses B<libpcap> to capture dns traffic and analyzes it. This
 option sets the interface that should be used. If this option is not set, or
 set to "any", the plugin will try to get packets from B<all> interfaces. This
 may not work on certain platforms, such as MacE<nbsp>OSE<nbsp>X.
@@ -2197,7 +2197,7 @@ Here are some examples to help you understand the above text more easily:
 
 =item B<IgnoreSelected>
 
-The behaviour is the same as with all other similar plugins: If nothing is
+The behavior is the same as with all other similar plugins: If nothing is
 selected at all, everything is collected. If some things are selected using the
 options described above, only these statistics are collected. If you set
 B<IgnoreSelected> to B<true>, this behavior is inverted, i.E<nbsp>e. the
@@ -2209,7 +2209,7 @@ specified statistics will not be collected.
 
 The Network plugin sends data to a remote instance of collectd, receives data
 from a remote instance, or both at the same time. Data which has been received
-from the network is usually not transmitted again, but this can be actived, see
+from the network is usually not transmitted again, but this can be activated, see
 the B<Forward> option below.
 
 The default IPv6 multicast group is C<ff18::efc0:4a42>. The default IPv4
@@ -2503,7 +2503,7 @@ UDP-Port to connect to. Defaults to B<123>.
 
 =item B<ReverseLookups> B<true>|B<false>
 
-Sets wether or not to perform reverse lookups on peers. Since the name or
+Sets whether or not to perform reverse lookups on peers. Since the name or
 IP-address may be used in a filename it is recommended to disable reverse
 lookups. The default is to do reverse lookups to preserve backwards
 compatibility, though.
index 3d8998f..957654b 100644 (file)
@@ -135,6 +135,12 @@ typedef bool _Bool;
 # ifndef isnan
 #  define isnan(f) ((f) != (f))
 # endif /* !defined(isnan) */
+# ifndef isfinite
+#  define isfinite(f) (((f) - (f)) == 0.0)
+# endif
+# ifndef isinf
+#  define isinf(f) (!isfinite(f) && !isnan(f))
+# endif
 #endif /* NAN_ZERO_ZERO */
 
 /* Try really, really hard to determine endianess. Under NexentaStor 1.0.2 this
index acc6cf6..3bd6309 100644 (file)
@@ -292,8 +292,8 @@ static void exec_child (program_list_t *pl) /* {{{ */
   status = getpwnam_r (pl->user, &sp, nambuf, sizeof (nambuf), &sp_ptr);
   if (status != 0)
   {
-    ERROR ("exec plugin: getpwnam_r failed: %s",
-       sstrerror (errno, errbuf, sizeof (errbuf)));
+    ERROR ("exec plugin: Failed to get user information for user ``%s'': %s",
+       pl->user, sstrerror (errno, errbuf, sizeof (errbuf)));
     exit (-1);
   }
   if (sp_ptr == NULL)
@@ -322,7 +322,8 @@ static void exec_child (program_list_t *pl) /* {{{ */
       status = getgrnam_r (pl->group, &gr, nambuf, sizeof (nambuf), &gr_ptr);
       if (0 != status)
       {
-       ERROR ("exec plugin: getgrnam_r failed: %s",
+       ERROR ("exec plugin: Failed to get group information "
+           "for group ``%s'': %s", pl->group,
            sstrerror (errno, errbuf, sizeof (errbuf)));
        exit (-1);
       }
@@ -388,8 +389,8 @@ static void exec_child (program_list_t *pl) /* {{{ */
 
   status = execvp (pl->exec, pl->argv);
 
-  ERROR ("exec plugin: exec failed: %s",
-      sstrerror (errno, errbuf, sizeof (errbuf)));
+  ERROR ("exec plugin: Failed to execute ``%s'': %s",
+      pl->exec, sstrerror (errno, errbuf, sizeof (errbuf)));
   exit (-1);
 } /* void exec_child }}} */
 
index 7c23a35..4b164dc 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * collectd - src/filter_chain.h
- * Copyright (C) 2008,2009  Florian octo Forster
+ * Copyright (C) 2008-2010  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
@@ -693,7 +693,14 @@ static int fc_bit_write_invoke (const data_set_t *ds, /* {{{ */
   if ((plugin_list == NULL) || (plugin_list[0] == NULL))
   {
     status = plugin_write (/* plugin = */ NULL, ds, vl);
-    if (status != 0)
+    if (status == ENOENT)
+    {
+      INFO ("Filter subsystem: Built-in target `write': Dispatching value to "
+          "all write plugins failed with status %i (ENOENT). "
+          "Most likely this means you didn't load any write plugins.",
+          status);
+    }
+    else if (status != 0)
     {
       INFO ("Filter subsystem: Built-in target `write': Dispatching value to "
           "all write plugins failed with status %i.", status);
index 1048511..30f5504 100644 (file)
@@ -397,7 +397,7 @@ static MYSQL *getconnection (mysql_database_t *db)
        }
        else
        {
-               INFO ("mysql plugin: Sucessfully connected to database %s "
+               INFO ("mysql plugin: Successfully connected to database %s "
                                "at server %s (server version: %s, protocol version: %d)",
                                (db->database != NULL) ? db->database : "<none>",
                                mysql_get_host_info (db->con),
index 5366b98..b536f42 100644 (file)
@@ -184,10 +184,11 @@ static void *ping_thread (void *arg) /* {{{ */
   count = 0;
   for (hl = hostlist_head; hl != NULL; hl = hl->next)
   {
-    int status;
-    status = ping_host_add (pingobj, hl->host);
-    if (status != 0)
-      WARNING ("ping plugin: ping_host_add (%s) failed.", hl->host);
+    int tmp_status;
+    tmp_status = ping_host_add (pingobj, hl->host);
+    if (tmp_status != 0)
+      WARNING ("ping plugin: ping_host_add (%s) failed: %s",
+          hl->host, ping_get_error (pingobj));
     else
       count++;
   }
@@ -217,7 +218,9 @@ static void *ping_thread (void *arg) /* {{{ */
 
     if (gettimeofday (&tv_begin, NULL) < 0)
     {
-      ERROR ("ping plugin: gettimeofday failed");
+      char errbuf[1024];
+      ERROR ("ping plugin: gettimeofday failed: %s",
+          sstrerror (errno, errbuf, sizeof (errbuf)));
       ping_thread_error = 1;
       break;
     }
@@ -322,7 +325,9 @@ static void *ping_thread (void *arg) /* {{{ */
 
     if (gettimeofday (&tv_end, NULL) < 0)
     {
-      ERROR ("ping plugin: gettimeofday failed");
+      char errbuf[1024];
+      ERROR ("ping plugin: gettimeofday failed: %s",
+          sstrerror (errno, errbuf, sizeof (errbuf)));
       ping_thread_error = 1;
       break;
     }
index 182892a..1eed532 100644 (file)
@@ -323,6 +323,13 @@ static int plugin_load_file (char *file, uint32_t flags)
        return (0);
 }
 
+static _Bool timeout_reached(struct timespec timeout)
+{
+       struct timeval now;
+       gettimeofday(&now, NULL);
+       return (now.tv_sec >= timeout.tv_sec && now.tv_usec >= (timeout.tv_nsec / 1000));
+}
+
 static void *plugin_read_thread (void __attribute__((unused)) *args)
 {
        while (read_loop != 0)
@@ -331,6 +338,7 @@ static void *plugin_read_thread (void __attribute__((unused)) *args)
                struct timeval now;
                int status;
                int rf_type;
+               int rc;
 
                /* Get the read function that needs to be read next. */
                rf = c_heap_get_root (read_heap);
@@ -366,8 +374,16 @@ static void *plugin_read_thread (void __attribute__((unused)) *args)
                /* sleep until this entry is due,
                 * using pthread_cond_timedwait */
                pthread_mutex_lock (&read_lock);
-               pthread_cond_timedwait (&read_cond, &read_lock,
+               /* In pthread_cond_timedwait, spurious wakeups are possible
+                * (and really happen, at least on NetBSD with > 1 CPU), thus
+                * we need to re-evaluate the condition every time
+                * pthread_cond_timedwait returns. */
+               rc = 0;
+               while (!timeout_reached(rf->rf_next_read) && rc == 0) {
+                       rc = pthread_cond_timedwait (&read_cond, &read_lock,
                                &rf->rf_next_read);
+               }
+
                /* Must hold `real_lock' when accessing `rf->rf_type'. */
                rf_type = rf->rf_type;
                pthread_mutex_unlock (&read_lock);
index d6dd0ba..e6527b9 100644 (file)
@@ -345,7 +345,7 @@ static int c_psql_exec_query (c_psql_database_t *db, udb_query_t *q)
                 * `BAIL_OUT'. */
                column_names[col] = PQfname (res, col);
                if (NULL == column_names[col]) {
-                       log_err ("Failed to resolv name of column %i.", col);
+                       log_err ("Failed to resolve name of column %i.", col);
                        BAIL_OUT (-1);
                }
        }
@@ -496,7 +496,7 @@ static int c_psql_init (void)
 
                server_host    = PQhost (db->conn);
                server_version = PQserverVersion (db->conn);
-               log_info ("Sucessfully connected to database %s (user %s) "
+               log_info ("Successfully connected to database %s (user %s) "
                                "at server %s%s%s (server version: %d.%d.%d, "
                                "protocol version: %d, pid: %d)",
                                PQdb (db->conn), PQuser (db->conn),
index 072593f..4ca9646 100644 (file)
 #include "utils_cache.h"
 #include "utils_parse_option.h"
 
+#define free_everything_and_return(status) do { \
+    size_t j; \
+    for (j = 0; j < number; j++) { \
+      sfree(names[j]); \
+      names[j] = NULL; \
+    } \
+    sfree(names); \
+    sfree(times); \
+    return (status); \
+  } 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))); \
-    return -1; \
+    free_everything_and_return (-1); \
   }
 
 int handle_listval (FILE *fh, char *buffer)
@@ -52,20 +63,20 @@ int handle_listval (FILE *fh, char *buffer)
   if (status != 0)
   {
     print_to_socket (fh, "-1 Cannot parse command.\n");
-    return (-1);
+    free_everything_and_return (-1);
   }
   assert (command != NULL);
 
   if (strcasecmp ("LISTVAL", command) != 0)
   {
     print_to_socket (fh, "-1 Unexpected command: `%s'.\n", command);
-    return (-1);
+    free_everything_and_return (-1);
   }
 
   if (*buffer != 0)
   {
     print_to_socket (fh, "-1 Garbage after end of command: %s\n", buffer);
-    return (-1);
+    free_everything_and_return (-1);
   }
 
   status = uc_get_names (&names, &times, &number);
@@ -73,21 +84,15 @@ int handle_listval (FILE *fh, char *buffer)
   {
     DEBUG ("command listval: uc_get_names failed with status %i", status);
     print_to_socket (fh, "-1 uc_get_names failed.\n");
-    return (-1);
+    free_everything_and_return (-1);
   }
 
   print_to_socket (fh, "%i Value%s found\n",
       (int) number, (number == 1) ? "" : "s");
   for (i = 0; i < number; i++)
-  {
     print_to_socket (fh, "%u %s\n", (unsigned int) times[i], names[i]);
-    sfree(names[i]);
-  }
 
-  sfree(names);
-  sfree(times);
-   
-  return (0);
+  free_everything_and_return (0);
 } /* int handle_listval */
 
 /* vim: set sw=2 sts=2 ts=8 : */
index a919316..75a73ae 100644 (file)
@@ -98,7 +98,12 @@ static int values_to_json (char *buffer, size_t buffer_size, /* {{{ */
       BUFFER_ADD (",");
 
     if (ds->ds[i].type == DS_TYPE_GAUGE)
-      BUFFER_ADD ("%g", vl->values[i].gauge);
+    {
+      if(isfinite (vl->values[i].gauge))
+        BUFFER_ADD ("%g", vl->values[i].gauge);
+      else
+        BUFFER_ADD ("null");
+    }
     else if (ds->ds[i].type == DS_TYPE_COUNTER)
       BUFFER_ADD ("%llu", vl->values[i].counter);
     else if (ds->ds[i].type == DS_TYPE_DERIVE)
index f14636b..1a49039 100644 (file)
@@ -142,7 +142,7 @@ static int wh_callback_init (wh_callback_t *cb) /* {{{ */
                 ssnprintf (cb->credentials, credentials_size, "%s:%s",
                                 cb->user, (cb->pass == NULL) ? "" : cb->pass);
                 curl_easy_setopt (cb->curl, CURLOPT_USERPWD, cb->credentials);
-                curl_easy_setopt (cb->curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
+                curl_easy_setopt (cb->curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
         }
 
         curl_easy_setopt (cb->curl, CURLOPT_SSL_VERIFYPEER, cb->verify_peer);