diff options
Diffstat (limited to 'web/attachments/216171-check_hpjd_jetreadysupport.patch')
-rw-r--r-- | web/attachments/216171-check_hpjd_jetreadysupport.patch | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/web/attachments/216171-check_hpjd_jetreadysupport.patch b/web/attachments/216171-check_hpjd_jetreadysupport.patch new file mode 100644 index 0000000..f33c934 --- /dev/null +++ b/web/attachments/216171-check_hpjd_jetreadysupport.patch | |||
@@ -0,0 +1,77 @@ | |||
1 | diff -Naur nagios-plugins-1.4.5-orig/plugins/check_hpjd.c nagios-plugins-1.4.5/plugins/check_hpjd.c | ||
2 | --- nagios-plugins-1.4.5-orig/plugins/check_hpjd.c 2006-10-18 20:25:16.000000000 -0400 | ||
3 | +++ nagios-plugins-1.4.5/plugins/check_hpjd.c 2007-02-15 12:31:34.000000000 -0500 | ||
4 | @@ -64,6 +64,11 @@ | ||
5 | |||
6 | #define ONLINE 0 | ||
7 | #define OFFLINE 1 | ||
8 | +#define JAONLINE 1 | ||
9 | +#define JAOFFLINE 0 | ||
10 | + | ||
11 | +#define JETDIRECT 0 | ||
12 | +#define JETREADY 1 | ||
13 | |||
14 | int process_arguments (int, char **); | ||
15 | int validate_arguments (void); | ||
16 | @@ -71,6 +76,7 @@ | ||
17 | void print_usage (void); | ||
18 | |||
19 | char *community = NULL; | ||
20 | +char *jd_type = JETDIRECT; // default to JetDirect type | ||
21 | char *address = NULL; | ||
22 | |||
23 | int | ||
24 | @@ -245,8 +251,8 @@ | ||
25 | result = STATE_WARNING; | ||
26 | strcpy (errmsg, _("Out of Paper")); | ||
27 | } | ||
28 | - else if (line_status == OFFLINE) { | ||
29 | - if (strcmp (errmsg, "POWERSAVE ON") != 0) { | ||
30 | + else if ((line_status == OFFLINE && jd_type == JETDIRECT) || (line_status == JAOFFLINE && jd_type == JETREADY)) { | ||
31 | + if ((strcmp (errmsg, "POWERSAVE ON") != 0) || (strcmp (errmsg, "Sleep mode on") != 0)) { | ||
32 | result = STATE_WARNING; | ||
33 | strcpy (errmsg, _("Printer Offline")); | ||
34 | } | ||
35 | @@ -317,6 +323,7 @@ | ||
36 | /* {"critical", required_argument,0,'c'}, */ | ||
37 | /* {"warning", required_argument,0,'w'}, */ | ||
38 | /* {"port", required_argument,0,'P'}, */ | ||
39 | + {"jetready", no_argument, 0, 'A'}, | ||
40 | {"version", no_argument, 0, 'V'}, | ||
41 | {"help", no_argument, 0, 'h'}, | ||
42 | {0, 0, 0, 0} | ||
43 | @@ -327,7 +334,7 @@ | ||
44 | |||
45 | |||
46 | while (1) { | ||
47 | - c = getopt_long (argc, argv, "+hVH:C:", longopts, &option); | ||
48 | + c = getopt_long (argc, argv, "+hVAH:C:", longopts, &option); | ||
49 | |||
50 | if (c == -1 || c == EOF || c == 1) | ||
51 | break; | ||
52 | @@ -344,6 +351,9 @@ | ||
53 | case 'C': /* community */ | ||
54 | community = strscpy (community, optarg); | ||
55 | break; | ||
56 | + case 'A': /* change jd type */ | ||
57 | + jd_type = JETREADY; | ||
58 | + break; | ||
59 | case 'V': /* version */ | ||
60 | print_revision (progname, revision); | ||
61 | exit (STATE_OK); | ||
62 | @@ -400,6 +410,8 @@ | ||
63 | |||
64 | printf (_(UT_HELP_VRSN)); | ||
65 | |||
66 | + printf (" %s\n", "-A, --jetready"); | ||
67 | + printf (" %s", _("Change logic from assuming JetDirect to JetReady support")); | ||
68 | printf (" %s\n", "-C, --community=STRING"); | ||
69 | printf (" %s", _("The SNMP community name ")); | ||
70 | printf (_("(default=%s)"), DEFAULT_COMMUNITY); | ||
71 | @@ -413,5 +425,5 @@ | ||
72 | print_usage (void) | ||
73 | { | ||
74 | printf (_("Usage:")); | ||
75 | - printf ("%s -H host [-C community]\n", progname); | ||
76 | + printf ("%s -H host [-a] [-C community]\n", progname); | ||
77 | } | ||