Code

Make alarm handler customisable
authorThomas Guyot-Sionnest <dermoth@aei.ca>
Fri, 20 Mar 2009 06:19:42 +0000 (02:19 -0400)
committerThomas Guyot-Sionnest <dermoth@aei.ca>
Fri, 20 Mar 2009 06:19:42 +0000 (02:19 -0400)
plugins/utils.c
plugins/utils.h

index 1900ef8601574e9e61970fcf286f07a497c200c3..45373909560552b462ccbb11ecdcc51c1a7a2ca8 100644 (file)
@@ -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);
        }
 }
 
index 65e06ebd3793c567add534f5a61885c8090f2ec2..d6e9c8f7211149d46e821686953b9fea672f5ad0 100644 (file)
@@ -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