diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_nagios.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c index c8cdbc0..4fd6342 100644 --- a/plugins/check_nagios.c +++ b/plugins/check_nagios.c | |||
@@ -205,6 +205,7 @@ process_arguments (int argc, char **argv) | |||
205 | {"filename", required_argument, 0, 'F'}, | 205 | {"filename", required_argument, 0, 'F'}, |
206 | {"expires", required_argument, 0, 'e'}, | 206 | {"expires", required_argument, 0, 'e'}, |
207 | {"command", required_argument, 0, 'C'}, | 207 | {"command", required_argument, 0, 'C'}, |
208 | {"timeout", optional_argument, 0, 't'}, | ||
208 | {"version", no_argument, 0, 'V'}, | 209 | {"version", no_argument, 0, 'V'}, |
209 | {"help", no_argument, 0, 'h'}, | 210 | {"help", no_argument, 0, 'h'}, |
210 | {"verbose", no_argument, 0, 'v'}, | 211 | {"verbose", no_argument, 0, 'v'}, |
@@ -226,7 +227,7 @@ process_arguments (int argc, char **argv) | |||
226 | } | 227 | } |
227 | 228 | ||
228 | while (1) { | 229 | while (1) { |
229 | c = getopt_long (argc, argv, "+hVvF:C:e:", longopts, &option); | 230 | c = getopt_long (argc, argv, "+hVvF:C:e:t:", longopts, &option); |
230 | 231 | ||
231 | if (c == -1 || c == EOF || c == 1) | 232 | if (c == -1 || c == EOF || c == 1) |
232 | break; | 233 | break; |
@@ -251,6 +252,13 @@ process_arguments (int argc, char **argv) | |||
251 | die (STATE_UNKNOWN, | 252 | die (STATE_UNKNOWN, |
252 | _("Expiration time must be an integer (seconds)\n")); | 253 | _("Expiration time must be an integer (seconds)\n")); |
253 | break; | 254 | break; |
255 | case 't': /* timeout */ | ||
256 | if (is_intnonneg (optarg)) | ||
257 | timeout_interval = atoi (optarg); | ||
258 | else | ||
259 | die (STATE_UNKNOWN, | ||
260 | _("Timeout must be an integer (seconds)\n")); | ||
261 | break; | ||
254 | case 'v': | 262 | case 'v': |
255 | verbose++; | 263 | verbose++; |
256 | break; | 264 | break; |
@@ -296,11 +304,13 @@ print_help (void) | |||
296 | printf (" %s\n", _("Minutes aging after which logfile is considered stale")); | 304 | printf (" %s\n", _("Minutes aging after which logfile is considered stale")); |
297 | printf (" %s\n", "-C, --command=STRING"); | 305 | printf (" %s\n", "-C, --command=STRING"); |
298 | printf (" %s\n", _("Substring to search for in process arguments")); | 306 | printf (" %s\n", _("Substring to search for in process arguments")); |
307 | printf (" %s\n", "-t, --timeout=INTEGER"); | ||
308 | printf (" %s\n", _("Timeout for the plugin in seconds")); | ||
299 | printf (UT_VERBOSE); | 309 | printf (UT_VERBOSE); |
300 | 310 | ||
301 | printf ("\n"); | 311 | printf ("\n"); |
302 | printf ("%s\n", _("Examples:")); | 312 | printf ("%s\n", _("Examples:")); |
303 | printf (" %s\n", "check_nagios -e 5 -F /usr/local/nagios/var/status.log -C /usr/local/nagios/bin/nagios"); | 313 | printf (" %s\n", "check_nagios -t 20 -e 5 -F /usr/local/nagios/var/status.log -C /usr/local/nagios/bin/nagios"); |
304 | 314 | ||
305 | printf (UT_SUPPORT); | 315 | printf (UT_SUPPORT); |
306 | } | 316 | } |
@@ -311,5 +321,5 @@ void | |||
311 | print_usage (void) | 321 | print_usage (void) |
312 | { | 322 | { |
313 | printf ("%s\n", _("Usage:")); | 323 | printf ("%s\n", _("Usage:")); |
314 | printf ("%s -F <status log file> -e <expire_minutes> -C <process_string>\n", progname); | 324 | printf ("%s -F <status log file> -t <timeout_seconds> -e <expire_minutes> -C <process_string>\n", progname); |
315 | } | 325 | } |