diff options
-rw-r--r-- | plugins/netutils.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/netutils.c b/plugins/netutils.c index f5df7f3d..e2916c65 100644 --- a/plugins/netutils.c +++ b/plugins/netutils.c | |||
@@ -28,6 +28,8 @@ | |||
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
29 | 29 | ||
30 | #include "common.h" | 30 | #include "common.h" |
31 | #include "output.h" | ||
32 | #include "states.h" | ||
31 | #include "netutils.h" | 33 | #include "netutils.h" |
32 | 34 | ||
33 | unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT; | 35 | unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT; |
@@ -43,13 +45,19 @@ int address_family = AF_INET; | |||
43 | 45 | ||
44 | /* handles socket timeouts */ | 46 | /* handles socket timeouts */ |
45 | void socket_timeout_alarm_handler(int sig) { | 47 | void socket_timeout_alarm_handler(int sig) { |
48 | mp_subcheck timeout_sc = mp_subcheck_init(); | ||
49 | timeout_sc = mp_set_subcheck_state(timeout_sc, socket_timeout_state); | ||
50 | |||
46 | if (sig == SIGALRM) { | 51 | if (sig == SIGALRM) { |
47 | printf(_("%s - Socket timeout after %d seconds\n"), state_text(socket_timeout_state), socket_timeout); | 52 | xasprintf(&timeout_sc.output, _("Socket timeout after %d seconds\n"), socket_timeout); |
48 | } else { | 53 | } else { |
49 | printf(_("%s - Abnormal timeout after %d seconds\n"), state_text(socket_timeout_state), socket_timeout); | 54 | xasprintf(&timeout_sc.output, _("Abnormal timeout after %d seconds\n"), socket_timeout); |
50 | } | 55 | } |
51 | 56 | ||
52 | exit(socket_timeout_state); | 57 | mp_check overall = mp_check_init(); |
58 | mp_add_subcheck_to_check(&overall, timeout_sc); | ||
59 | |||
60 | mp_exit(overall); | ||
53 | } | 61 | } |
54 | 62 | ||
55 | /* connects to a host on a specified tcp port, sends a string, and gets a | 63 | /* connects to a host on a specified tcp port, sends a string, and gets a |