Bumped version to 3.5.2
authorocto <octo>
Sat, 21 Jan 2006 10:57:46 +0000 (10:57 +0000)
committerocto <octo>
Sat, 21 Jan 2006 10:57:46 +0000 (10:57 +0000)
Ported improvements on ping-plugin from 3.6.0 to 3.5.2
Fixed typo in the signal handling..

ChangeLog
collectd.spec
configure.in
debian/changelog
src/collectd.c
src/ping.c

index a785e3b..4c42b00 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-01-21, Version 3.5.2
+       * Fixed yet another bug in the signal handling.. Stupid typo..
+       * Improved the ping plugin to not give up on socket errors (backport
+         from 3.6.0).
+
 2005-12-18, Version 3.5.1
        * The PID-file is now deleted correctly when shutting down the daemon.
        * SIGINT and SIGTERM are now handled correctly.
index 0bc5bd2..6e20862 100644 (file)
@@ -1,6 +1,6 @@
 Summary:       Statistics collection daemon for filling RRD files.
 Name:           collectd
-Version:       3.5.1
+Version:       3.5.2
 Release:       1
 Source:                http://verplant.org/collectd/%{name}-%{version}.tar.gz
 License:       GPL
@@ -84,6 +84,9 @@ rm -rf $RPM_BUILD_ROOT
 %attr(0444,root,root) %{_libdir}/%{name}/hddtemp.so*
 
 %changelog
+* Sat Jan 21 2006 Florian octo Forster <octo@verplant.org> 3.5.2-1
+- New upstream version
+
 * Wed Dec 07 2005 Florian octo Forster <octo@verplant.org> 3.5.0-1
 - New upstream version
 
index db2fdb5..bed79f5 100644 (file)
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(collectd, 3.5.0)
+AC_INIT(collectd, 3.5.2)
 AC_CONFIG_SRCDIR(src/collectd.c)
 AC_CONFIG_HEADERS(src/config.h)
 AM_INIT_AUTOMAKE(dist-bzip2)
index 9488d3c..97801ab 100644 (file)
@@ -1,3 +1,9 @@
+collectd (3.5.2-1) unstable; urgency=low
+
+  * New upstream version
+
+ -- Florian Forster <octo@verplant.org>  Sat, 21 Jan 2006 11:55:49 +0200
+
 collectd (3.5.1-1) unstable; urgency=low
 
   * New upstream version
index 4fdfcf1..97f1edc 100644 (file)
@@ -411,7 +411,7 @@ int main (int argc, char **argv)
        sigIntAction.sa_handler = sigIntHandler;
        sigaction (SIGINT, &sigIntAction, NULL);
 
-       sigIntAction.sa_handler = sigTermHandler;
+       sigTermAction.sa_handler = sigTermHandler;
        sigaction (SIGTERM, &sigTermAction, NULL);
 
        /*
index d418232..32cfd29 100644 (file)
 #include <netinet/in.h>
 #include "libping/ping.h"
 
-extern char *pinghosts[MAX_PINGHOSTS];
-extern int   num_pinghosts;
-static int   pingerrors[MAX_PINGHOSTS];
+static char *hosts[MAX_PINGHOSTS];
+static int   hosts_flags[MAX_PINGHOSTS];
+static int   hosts_disable[MAX_PINGHOSTS];
+static int   hosts_backoff[MAX_PINGHOSTS];
+static int   num_pinghosts;
 
 static char *file_template = "ping-%s.rrd";
 
@@ -48,8 +50,12 @@ void ping_init (void)
 {
        int i;
 
-       for (i = 0; i < num_pinghosts; i++)
-               pingerrors[i] = 0;
+       for (i = 0; i < MAX_PINGHOSTS; i++)
+       {
+               hosts_flags[i] = 0;
+               hosts_disable[i] = 0;
+               hosts_backoff[i] = 1;
+       }
 
        return;
 }
@@ -87,41 +93,49 @@ void ping_read (void)
 
        for (i = 0; i < num_pinghosts; i++)
        {
-               if (pingerrors[i] & 0x30)
+               if (hosts_disable[i] > 0)
+               {
+                       hosts_disable[i]--;
                        continue;
+               }
                
-               ping = tpinghost (pinghosts[i]);
+               ping = tpinghost (hosts[i]);
 
                switch (ping)
                {
                        case 0:
-                               if (!(pingerrors[i] & 0x01))
-                                       syslog (LOG_WARNING, "ping %s: Connection timed out.", pinghosts[i]);
-                               pingerrors[i] |= 0x01;
+                               if (!(hosts_flags[i] & 0x01))
+                                       syslog (LOG_WARNING, "ping %s: Connection timed out.", hosts[i]);
+                               hosts_flags[i] |= 0x01;
                                break;
 
                        case -1:
-                               if (!(pingerrors[i] & 0x02))
-                                       syslog (LOG_WARNING, "ping %s: Host or service is not reachable.", pinghosts[i]);
-                               pingerrors[i] |= 0x02;
+                               if (!(hosts_flags[i] & 0x02))
+                                       syslog (LOG_WARNING, "ping %s: Host or service is not reachable.", hosts[i]);
+                               hosts_flags[i] |= 0x02;
                                break;
 
                        case -2:
-                               syslog (LOG_ERR, "ping %s: Socket error. Ping will be disabled.", pinghosts[i]);
-                               pingerrors[i] |= 0x10;
+                               syslog (LOG_ERR, "ping %s: Socket error. Ping will be disabled for %i iteration(s).",
+                                               hosts[i], hosts_backoff[i]);
+                               hosts_disable[i] = hosts_backoff[i];
+                               if (hosts_backoff[i] < 8192) /* 22 3/4 hours */
+                                       hosts_backoff[i] *= 2;
+                               hosts_flags[i] |= 0x10;
                                break;
 
                        case -3:
-                               if (!(pingerrors[i] & 0x04))
-                                       syslog (LOG_WARNING, "ping %s: Connection refused.", pinghosts[i]);
-                               pingerrors[i] |= 0x04;
+                               if (!(hosts_flags[i] & 0x04))
+                                       syslog (LOG_WARNING, "ping %s: Connection refused.", hosts[i]);
+                               hosts_flags[i] |= 0x04;
                                break;
 
                        default:
-                               if (pingerrors[i] != 0x00)
-                                       syslog (LOG_NOTICE, "ping %s: Back to normal: %ims.", pinghosts[i], ping);
-                               pingerrors[i] = 0x00;
-                               ping_submit (ping, pinghosts[i]);
+                               if (hosts_flags[i] != 0x00)
+                                       syslog (LOG_NOTICE, "ping %s: Back to normal: %ims.", hosts[i], ping);
+                               hosts_flags[i] = 0x00;
+                               hosts_backoff[i] = 1;
+                               ping_submit (ping, hosts[i]);
                } /* switch (ping) */
        } /* for (i = 0; i < num_pinghosts; i++) */
 }