]>
Commit | Line | Data |
---|---|---|
d76fcccd AM |
1 | diff -urNp -x '*.orig' nagios-plugins-2.3.3.org/plugins/check_hpjd.c nagios-plugins-2.3.3/plugins/check_hpjd.c |
2 | --- nagios-plugins-2.3.3.org/plugins/check_hpjd.c 2019-12-04 22:53:08.000000000 +0100 | |
3 | +++ nagios-plugins-2.3.3/plugins/check_hpjd.c 2021-04-19 12:01:52.206215349 +0200 | |
4 | @@ -41,7 +41,7 @@ const char *email = "devel@nagios-plugin | |
9cc2238c ER |
5 | #define DEFAULT_COMMUNITY "public" |
6 | #define DEFAULT_PORT "161" | |
91a279db | 7 | |
9cc2238c ER |
8 | -const char *option_summary = "-H host [-C community]\n"; |
9 | +const char *option_summary = "-H host [-C community] [-n]\n"; | |
10 | ||
11 | #define HPJD_LINE_STATUS ".1.3.6.1.4.1.11.2.3.9.1.1.2.1" | |
12 | #define HPJD_PAPER_STATUS ".1.3.6.1.4.1.11.2.3.9.1.1.2.2" | |
62a10611 | 13 | @@ -68,6 +68,7 @@ char *community = NULL; |
91a279db | 14 | char *address = NULL; |
56b1be76 | 15 | int port = 0; |
62a10611 | 16 | char flawcorrection =0; // There are devices which report offline when that is not the case. Correct that. |
91a279db JR |
17 | +int nopaperout = 0; |
18 | ||
19 | int | |
20 | main (int argc, char **argv) | |
d76fcccd | 21 | @@ -251,7 +252,9 @@ main (int argc, char **argv) |
91a279db JR |
22 | strcpy (errmsg, _("Paper Jam")); |
23 | } | |
24 | else if (paper_out) { | |
25 | - result = STATE_WARNING; | |
26 | + if (!nopaperout) { | |
27 | + result = STATE_WARNING; | |
28 | + } | |
29 | strcpy (errmsg, _("Out of Paper")); | |
30 | } | |
31 | else if (line_status == OFFLINE) { | |
d76fcccd | 32 | @@ -326,6 +329,7 @@ process_arguments (int argc, char **argv |
91a279db JR |
33 | /* {"critical", required_argument,0,'c'}, */ |
34 | /* {"warning", required_argument,0,'w'}, */ | |
9cc2238c | 35 | {"port", required_argument,0,'p'}, |
91a279db | 36 | + {"nopaperout", no_argument, 0, 'n'}, |
62a10611 | 37 | {"flawcorrection", no_argument, 0, 'N'}, |
91a279db JR |
38 | {"version", no_argument, 0, 'V'}, |
39 | {"help", no_argument, 0, 'h'}, | |
d76fcccd | 40 | @@ -337,7 +341,7 @@ process_arguments (int argc, char **argv |
9cc2238c | 41 | |
91a279db | 42 | |
91a279db | 43 | while (1) { |
62a10611 AM |
44 | - c = getopt_long (argc, argv, "+hVNH:C:p:", longopts, &option); |
45 | + c = getopt_long (argc, argv, "+hnNVH:C:p:", longopts, &option); | |
91a279db JR |
46 | |
47 | if (c == -1 || c == EOF || c == 1) | |
48 | break; | |
d76fcccd | 49 | @@ -360,6 +364,9 @@ process_arguments (int argc, char **argv |
62a10611 AM |
50 | else |
51 | port = atoi(optarg); | |
91a279db JR |
52 | break; |
53 | + case 'n': /* nopaperout */ | |
54 | + nopaperout = 1; | |
55 | + break; | |
62a10611 AM |
56 | case 'N': /* flaw correction */ |
57 | flawcorrection=1; | |
58 | break; | |
d76fcccd | 59 | @@ -429,7 +436,9 @@ print_help (void) |
91a279db JR |
60 | |
61 | printf (" %s\n", "-C, --community=STRING"); | |
62 | printf (" %s", _("The SNMP community name ")); | |
63 | + printf (" %s\n", "-n, --nopaperout"); | |
64 | printf (_("(default=%s)"), DEFAULT_COMMUNITY); | |
65 | + printf (" %s\n", "No return WARNING state on \"Out of paper\""); | |
66 | printf ("\n"); | |
d76fcccd AM |
67 | printf (" %s\n", "-p, --port=STRING"); |
68 | printf (" %s", _("Specify the port to check ")); | |
69 | @@ -449,5 +458,5 @@ void | |
91a279db JR |
70 | print_usage (void) |
71 | { | |
5a0f8fb3 | 72 | printf ("%s\n", _("Usage:")); |
62a10611 AM |
73 | - printf ("%s -H host [-C community] [-p port][-N]\n", progname); |
74 | + printf ("%s -H host [-C community] [-p port] [-N] [-n]\n", progname); | |
91a279db | 75 | } |