diff options
| author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2009-03-20 02:19:42 -0400 |
|---|---|---|
| committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2009-03-20 02:19:42 -0400 |
| commit | c459ca07706ee315da3eac91344c2f1d9a152685 (patch) | |
| tree | d91659325daad0a7580fbbf6ea6719f84fb9ef2f | |
| parent | 4142e178403483d6c1a27e765c0a86e77278c2d6 (diff) | |
| download | monitoring-plugins-c459ca07706ee315da3eac91344c2f1d9a152685.tar.gz | |
Make alarm handler customisable
| -rw-r--r-- | plugins/utils.c | 6 | ||||
| -rw-r--r-- | plugins/utils.h | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/plugins/utils.c b/plugins/utils.c index 1900ef86..45373909 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
| @@ -168,9 +168,9 @@ void | |||
| 168 | timeout_alarm_handler (int signo) | 168 | timeout_alarm_handler (int signo) |
| 169 | { | 169 | { |
| 170 | if (signo == SIGALRM) { | 170 | if (signo == SIGALRM) { |
| 171 | printf (_("CRITICAL - Plugin timed out after %d seconds\n"), | 171 | printf (_("%s - Plugin timed out after %d seconds\n"), |
| 172 | timeout_interval); | 172 | state_text(timeout_state), timeout_interval); |
| 173 | exit (STATE_CRITICAL); | 173 | exit (timeout_state); |
| 174 | } | 174 | } |
| 175 | } | 175 | } |
| 176 | 176 | ||
diff --git a/plugins/utils.h b/plugins/utils.h index 65e06ebd..d6e9c8f7 100644 --- a/plugins/utils.h +++ b/plugins/utils.h | |||
| @@ -32,9 +32,11 @@ void print_revision (const char *, const char *); | |||
| 32 | /* Handle timeouts */ | 32 | /* Handle timeouts */ |
| 33 | 33 | ||
| 34 | #ifdef LOCAL_TIMEOUT_ALARM_HANDLER | 34 | #ifdef LOCAL_TIMEOUT_ALARM_HANDLER |
| 35 | extern unsigned int timeout_state; | ||
| 35 | extern unsigned int timeout_interval; | 36 | extern unsigned int timeout_interval; |
| 36 | RETSIGTYPE timeout_alarm_handler (int); | 37 | RETSIGTYPE timeout_alarm_handler (int); |
| 37 | #else | 38 | #else |
| 39 | unsigned int timeout_state = STATE_CRITICAL; | ||
| 38 | unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT; | 40 | unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT; |
| 39 | extern RETSIGTYPE timeout_alarm_handler (int); | 41 | extern RETSIGTYPE timeout_alarm_handler (int); |
| 40 | #endif | 42 | #endif |
