From: Thomas Guyot-Sionnest Date: Fri, 20 Mar 2009 06:19:42 +0000 (-0400) Subject: Make alarm handler customisable X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c459ca07;p=nagiosplug.git Make alarm handler customisable --- diff --git a/plugins/utils.c b/plugins/utils.c index 1900ef8..4537390 100644 --- a/plugins/utils.c +++ b/plugins/utils.c @@ -168,9 +168,9 @@ void timeout_alarm_handler (int signo) { if (signo == SIGALRM) { - printf (_("CRITICAL - Plugin timed out after %d seconds\n"), - timeout_interval); - exit (STATE_CRITICAL); + printf (_("%s - Plugin timed out after %d seconds\n"), + state_text(timeout_state), timeout_interval); + exit (timeout_state); } } diff --git a/plugins/utils.h b/plugins/utils.h index 65e06eb..d6e9c8f 100644 --- a/plugins/utils.h +++ b/plugins/utils.h @@ -32,9 +32,11 @@ void print_revision (const char *, const char *); /* Handle timeouts */ #ifdef LOCAL_TIMEOUT_ALARM_HANDLER +extern unsigned int timeout_state; extern unsigned int timeout_interval; RETSIGTYPE timeout_alarm_handler (int); #else +unsigned int timeout_state = STATE_CRITICAL; unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT; extern RETSIGTYPE timeout_alarm_handler (int); #endif