diff options
author | Kostyantyn Hushchyn <kgushtin@op5.com> | 2010-09-07 14:54:20 +0300 |
---|---|---|
committer | Jacob Hansen <jhansen@op5.com> | 2019-01-04 15:01:28 +0100 |
commit | f79f016238f436b94dfeb04c981de3a6d3e9d31c (patch) | |
tree | f3000e2ad132a5d987ff4f3fc593b273ee021f4d /plugins | |
parent | ac6f101f057caa3083c092537e6dff97328cfd44 (diff) | |
download | monitoring-plugins-f79f016238f436b94dfeb04c981de3a6d3e9d31c.tar.gz |
check_hpjd: Added -D option to disable warning on 'out of paper'
Signed-off-by: Kostyantyn Hushchyn <kgushtin@op5.com>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_hpjd.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c index f159f5a2..65465567 100644 --- a/plugins/check_hpjd.c +++ b/plugins/check_hpjd.c | |||
@@ -67,6 +67,7 @@ void print_usage (void); | |||
67 | char *community = NULL; | 67 | char *community = NULL; |
68 | char *address = NULL; | 68 | char *address = NULL; |
69 | char *port = NULL; | 69 | char *port = NULL; |
70 | int check_paper_out = 1; | ||
70 | 71 | ||
71 | int | 72 | int |
72 | main (int argc, char **argv) | 73 | main (int argc, char **argv) |
@@ -240,7 +241,8 @@ main (int argc, char **argv) | |||
240 | strcpy (errmsg, _("Paper Jam")); | 241 | strcpy (errmsg, _("Paper Jam")); |
241 | } | 242 | } |
242 | else if (paper_out) { | 243 | else if (paper_out) { |
243 | result = STATE_WARNING; | 244 | if (check_paper_out) |
245 | result = STATE_WARNING; | ||
244 | strcpy (errmsg, _("Out of Paper")); | 246 | strcpy (errmsg, _("Out of Paper")); |
245 | } | 247 | } |
246 | else if (line_status == OFFLINE) { | 248 | else if (line_status == OFFLINE) { |
@@ -325,7 +327,7 @@ process_arguments (int argc, char **argv) | |||
325 | 327 | ||
326 | 328 | ||
327 | while (1) { | 329 | while (1) { |
328 | c = getopt_long (argc, argv, "+hVH:C:p:", longopts, &option); | 330 | c = getopt_long (argc, argv, "+hVH:C:p:D", longopts, &option); |
329 | 331 | ||
330 | if (c == -1 || c == EOF || c == 1) | 332 | if (c == -1 || c == EOF || c == 1) |
331 | break; | 333 | break; |
@@ -347,6 +349,8 @@ process_arguments (int argc, char **argv) | |||
347 | usage2 (_("Port must be a positive short integer"), optarg); | 349 | usage2 (_("Port must be a positive short integer"), optarg); |
348 | else | 350 | else |
349 | port = atoi(optarg); | 351 | port = atoi(optarg); |
352 | case 'D': /* disable paper out check*/ | ||
353 | check_paper_out = 0; | ||
350 | break; | 354 | break; |
351 | case 'V': /* version */ | 355 | case 'V': /* version */ |
352 | print_revision (progname, NP_VERSION); | 356 | print_revision (progname, NP_VERSION); |
@@ -420,6 +424,8 @@ print_help (void) | |||
420 | printf (" %s", _("Specify the port to check ")); | 424 | printf (" %s", _("Specify the port to check ")); |
421 | printf (_("(default=%s)"), DEFAULT_PORT); | 425 | printf (_("(default=%s)"), DEFAULT_PORT); |
422 | printf ("\n"); | 426 | printf ("\n"); |
427 | printf (" %s\n", "-D"); | ||
428 | printf (" %s", _("Disable paper check ")); | ||
423 | 429 | ||
424 | printf (UT_SUPPORT); | 430 | printf (UT_SUPPORT); |
425 | } | 431 | } |
@@ -430,5 +436,5 @@ void | |||
430 | print_usage (void) | 436 | print_usage (void) |
431 | { | 437 | { |
432 | printf ("%s\n", _("Usage:")); | 438 | printf ("%s\n", _("Usage:")); |
433 | printf ("%s -H host [-C community] [-p port]\n", progname); | 439 | printf ("%s -H host [-C community] [-p port] [-D]\n", progname); |
434 | } | 440 | } |