]>
Commit | Line | Data |
---|---|---|
56b1be76 ER |
1 | --- nagios-plugins-2.1.3/plugins/check_hpjd.c~ 2016-09-13 19:59:41.000000000 +0300 |
2 | +++ nagios-plugins-2.1.3/plugins/check_hpjd.c 2016-09-13 20:00:10.839538694 +0300 | |
9cc2238c ER |
3 | @@ -41,7 +41,7 @@ |
4 | #define DEFAULT_COMMUNITY "public" | |
5 | #define DEFAULT_PORT "161" | |
91a279db | 6 | |
9cc2238c ER |
7 | -const char *option_summary = "-H host [-C community]\n"; |
8 | +const char *option_summary = "-H host [-C community] [-n]\n"; | |
9 | ||
10 | #define HPJD_LINE_STATUS ".1.3.6.1.4.1.11.2.3.9.1.1.2.1" | |
11 | #define HPJD_PAPER_STATUS ".1.3.6.1.4.1.11.2.3.9.1.1.2.2" | |
12 | @@ -67,6 +67,7 @@ | |
91a279db JR |
13 | char *community = NULL; |
14 | char *address = NULL; | |
56b1be76 | 15 | int port = 0; |
91a279db JR |
16 | +int nopaperout = 0; |
17 | ||
18 | int | |
19 | main (int argc, char **argv) | |
20 | @@ -243,7 +244,9 @@ | |
21 | strcpy (errmsg, _("Paper Jam")); | |
22 | } | |
23 | else if (paper_out) { | |
24 | - result = STATE_WARNING; | |
25 | + if (!nopaperout) { | |
26 | + result = STATE_WARNING; | |
27 | + } | |
28 | strcpy (errmsg, _("Out of Paper")); | |
29 | } | |
30 | else if (line_status == OFFLINE) { | |
9cc2238c | 31 | @@ -317,6 +318,7 @@ |
91a279db JR |
32 | /* {"critical", required_argument,0,'c'}, */ |
33 | /* {"warning", required_argument,0,'w'}, */ | |
9cc2238c | 34 | {"port", required_argument,0,'p'}, |
91a279db JR |
35 | + {"nopaperout", no_argument, 0, 'n'}, |
36 | {"version", no_argument, 0, 'V'}, | |
37 | {"help", no_argument, 0, 'h'}, | |
38 | {0, 0, 0, 0} | |
9cc2238c ER |
39 | @@ -327,7 +329,7 @@ |
40 | ||
91a279db | 41 | |
91a279db | 42 | while (1) { |
9cc2238c ER |
43 | - c = getopt_long (argc, argv, "+hVH:C:p:", longopts, &option); |
44 | + c = getopt_long (argc, argv, "+hnVH:C:p:", longopts, &option); | |
91a279db JR |
45 | |
46 | if (c == -1 || c == EOF || c == 1) | |
47 | break; | |
48 | @@ -345,6 +349,9 @@ | |
49 | case 'C': /* community */ | |
50 | community = strscpy (community, optarg); | |
51 | break; | |
52 | + case 'n': /* nopaperout */ | |
53 | + nopaperout = 1; | |
54 | + break; | |
55 | case 'V': /* version */ | |
56 | print_revision (progname, revision); | |
57 | exit (STATE_OK); | |
58 | @@ -404,7 +411,9 @@ | |
59 | ||
60 | printf (" %s\n", "-C, --community=STRING"); | |
61 | printf (" %s", _("The SNMP community name ")); | |
62 | + printf (" %s\n", "-n, --nopaperout"); | |
63 | printf (_("(default=%s)"), DEFAULT_COMMUNITY); | |
64 | + printf (" %s\n", "No return WARNING state on \"Out of paper\""); | |
65 | printf ("\n"); | |
66 | ||
67 | #ifdef NP_EXTRA_OPTS | |
9cc2238c | 68 | @@ -437,5 +439,5 @@ |
91a279db JR |
69 | print_usage (void) |
70 | { | |
5a0f8fb3 | 71 | printf ("%s\n", _("Usage:")); |
9cc2238c ER |
72 | - printf ("%s -H host [-C community] [-p port]\n", progname); |
73 | + printf ("%s -H host [-C community] [-p port] [-n]\n", progname); | |
91a279db | 74 | } |