summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8c65952)
raw | patch | inline | side by side (parent: 8c65952)
author | octo <octo> | |
Sun, 22 Jan 2006 16:58:40 +0000 (16:58 +0000) | ||
committer | octo <octo> | |
Sun, 22 Jan 2006 16:58:40 +0000 (16:58 +0000) |
configure.in | patch | blob | history | |
src/ping.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index bed79f5e3352377161f429be6efc29f6228a91f2..37a61b87b6e59089625e70077b4b82deebb329df 100644 (file)
--- a/configure.in
+++ b/configure.in
AC_CHECK_FUNCS(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
AC_CHECK_FUNCS(strncasecmp strcasecmp)
+AC_CHECK_FUNCS(openlog syslog closelog)
# For cpu module
AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
diff --git a/src/ping.c b/src/ping.c
index 32cfd29bebfd599f1d055ba8316c99225db8f0fa..4bc6fef3106a42206e221c2d74a09c8ac26b6084 100644 (file)
--- a/src/ping.c
+++ b/src/ping.c
#include <netinet/in.h>
#include "libping/ping.h"
-static char *hosts[MAX_PINGHOSTS];
+extern char *pinghosts[MAX_PINGHOSTS];
+extern int num_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";
continue;
}
- ping = tpinghost (hosts[i]);
+ ping = tpinghost (pinghosts[i]);
switch (ping)
{
case 0:
if (!(hosts_flags[i] & 0x01))
- syslog (LOG_WARNING, "ping %s: Connection timed out.", hosts[i]);
+ syslog (LOG_WARNING, "ping %s: Connection timed out.", pinghosts[i]);
hosts_flags[i] |= 0x01;
break;
case -1:
if (!(hosts_flags[i] & 0x02))
- syslog (LOG_WARNING, "ping %s: Host or service is not reachable.", hosts[i]);
+ syslog (LOG_WARNING, "ping %s: Host or service is not reachable.", pinghosts[i]);
hosts_flags[i] |= 0x02;
break;
case -2:
syslog (LOG_ERR, "ping %s: Socket error. Ping will be disabled for %i iteration(s).",
- hosts[i], hosts_backoff[i]);
+ pinghosts[i], hosts_backoff[i]);
hosts_disable[i] = hosts_backoff[i];
if (hosts_backoff[i] < 8192) /* 22 3/4 hours */
hosts_backoff[i] *= 2;
case -3:
if (!(hosts_flags[i] & 0x04))
- syslog (LOG_WARNING, "ping %s: Connection refused.", hosts[i]);
+ syslog (LOG_WARNING, "ping %s: Connection refused.", pinghosts[i]);
hosts_flags[i] |= 0x04;
break;
default:
if (hosts_flags[i] != 0x00)
- syslog (LOG_NOTICE, "ping %s: Back to normal: %ims.", hosts[i], ping);
+ syslog (LOG_NOTICE, "ping %s: Back to normal: %ims.", pinghosts[i], ping);
hosts_flags[i] = 0x00;
hosts_backoff[i] = 1;
- ping_submit (ping, hosts[i]);
+ ping_submit (ping, pinghosts[i]);
} /* switch (ping) */
} /* for (i = 0; i < num_pinghosts; i++) */
}