summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_snmp.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 0bc810d1..52ad31ea 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -33,6 +33,7 @@ const char *copyright = "1999-2007";
33const char *email = "nagiosplug-devel@lists.sourceforge.net"; 33const char *email = "nagiosplug-devel@lists.sourceforge.net";
34 34
35#include "common.h" 35#include "common.h"
36#include "runcmd.h"
36#include "utils.h" 37#include "utils.h"
37#include "utils_cmd.h" 38#include "utils_cmd.h"
38 39
@@ -330,9 +331,18 @@ main (int argc, char **argv)
330 if (verbose) 331 if (verbose)
331 printf ("%s\n", cl_hidden_auth); 332 printf ("%s\n", cl_hidden_auth);
332 333
334 /* Set signal handling and alarm */
335 if (signal (SIGALRM, runcmd_timeout_alarm_handler) == SIG_ERR) {
336 usage4 (_("Cannot catch SIGALRM"));
337 }
338 alarm(timeout_interval * retries + 5);
339
333 /* Run the command */ 340 /* Run the command */
334 return_code = cmd_run_array (command_line, &chld_out, &chld_err, 0); 341 return_code = cmd_run_array (command_line, &chld_out, &chld_err, 0);
335 342
343 /* disable alarm again */
344 alarm(0);
345
336 /* Due to net-snmp sometimes showing stderr messages with poorly formed MIBs, 346 /* Due to net-snmp sometimes showing stderr messages with poorly formed MIBs,
337 only return state unknown if return code is non zero or there is no stdout. 347 only return state unknown if return code is non zero or there is no stdout.
338 Do this way so that if there is stderr, will get added to output, which helps problem diagnosis 348 Do this way so that if there is stderr, will get added to output, which helps problem diagnosis