Make alarm handler customisable

This commit is contained in:
Thomas Guyot-Sionnest 2009-03-20 02:19:42 -04:00
parent 4142e17840
commit c459ca0770
2 changed files with 5 additions and 3 deletions

View file

@ -168,9 +168,9 @@ void
timeout_alarm_handler (int signo) timeout_alarm_handler (int signo)
{ {
if (signo == SIGALRM) { if (signo == SIGALRM) {
printf (_("CRITICAL - Plugin timed out after %d seconds\n"), printf (_("%s - Plugin timed out after %d seconds\n"),
timeout_interval); state_text(timeout_state), timeout_interval);
exit (STATE_CRITICAL); exit (timeout_state);
} }
} }

View file

@ -32,9 +32,11 @@ void print_revision (const char *, const char *);
/* Handle timeouts */ /* Handle timeouts */
#ifdef LOCAL_TIMEOUT_ALARM_HANDLER #ifdef LOCAL_TIMEOUT_ALARM_HANDLER
extern unsigned int timeout_state;
extern unsigned int timeout_interval; extern unsigned int timeout_interval;
RETSIGTYPE timeout_alarm_handler (int); RETSIGTYPE timeout_alarm_handler (int);
#else #else
unsigned int timeout_state = STATE_CRITICAL;
unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT; unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT;
extern RETSIGTYPE timeout_alarm_handler (int); extern RETSIGTYPE timeout_alarm_handler (int);
#endif #endif