Revision: 2185
http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2185&view=rev
Author: dermoth
Date: 2009-03-25 12:53:15 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
Make socket alarm handler customisable (like c459ca07)
From: Thomas Guyot-Sionnest <[email protected]>
Modified Paths:
--------------
nagiosplug/trunk/plugins/netutils.c
nagiosplug/trunk/plugins/netutils.h
Modified: nagiosplug/trunk/plugins/netutils.c
===================================================================
--- nagiosplug/trunk/plugins/netutils.c 2009-03-24 06:03:12 UTC (rev 2184)
+++ nagiosplug/trunk/plugins/netutils.c 2009-03-25 12:53:15 UTC (rev 2185)
@@ -32,7 +32,6 @@
#include "common.h"
#include "netutils.h"
-unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
int econn_refuse_state = STATE_CRITICAL;
int was_refused = FALSE;
#if USE_IPV6
@@ -46,11 +45,11 @@
socket_timeout_alarm_handler (int sig)
{
if (sig == SIGALRM)
- printf (_("CRITICAL - Socket timeout after %d seconds\n"), socket_timeout);
+ printf (_("%s - Socket timeout after %d seconds\n"), state_text(socket_timeout_state), socket_timeout);
else
- printf (_("CRITICAL - Abnormal timeout after %d seconds\n"), socket_timeout);
+ printf (_("%s - Abnormal timeout after %d seconds\n"), state_text(socket_timeout_state), socket_timeout);
- exit (STATE_CRITICAL);
+ exit (socket_timeout_state);
}
Modified: nagiosplug/trunk/plugins/netutils.h
===================================================================
--- nagiosplug/trunk/plugins/netutils.h 2009-03-24 06:03:12 UTC (rev 2184)
+++ nagiosplug/trunk/plugins/netutils.h 2009-03-25 12:53:15 UTC (rev 2185)
@@ -45,8 +45,6 @@
# endif /* UNIX_PATH_MAX */
#endif /* HAVE_SYS_UN_H */
-RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
-
/* process_request and wrapper macros */
#define process_tcp_request(addr, port, sbuf, rbuf, rsize) \
process_request(addr, port, IPPROTO_TCP, sbuf, rbuf, rsize)
@@ -83,7 +81,16 @@
# define is_hostname(addr) resolve_host_or_addr(addr, AF_INET)
#endif
+#ifdef LOCAL_TIMEOUT_ALARM_HANDLER
extern unsigned int socket_timeout;
+extern int socket_timeout_state;
+RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
+#else
+unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
+unsigned int socket_timeout_state = STATE_CRITICAL;
+extern RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
+#endif
+
extern int econn_refuse_state;
extern int was_refused;
extern int address_family;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.