]> git.pld-linux.org Git - packages/nagios-plugins.git/blob - nagios-plugins-check_hpjd-no-paper-out.patch
up to 2.1.3
[packages/nagios-plugins.git] / nagios-plugins-check_hpjd-no-paper-out.patch
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
3 @@ -41,7 +41,7 @@
4  #define DEFAULT_COMMUNITY "public"
5  #define DEFAULT_PORT "161"
6  
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 @@
13  char *community = NULL;
14  char *address = NULL;
15  int port = 0;
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) {
31 @@ -317,6 +318,7 @@
32  /*             {"critical",       required_argument,0,'c'}, */
33  /*             {"warning",        required_argument,0,'w'}, */
34                 {"port", required_argument,0,'p'}, 
35 +               {"nopaperout", no_argument, 0, 'n'},
36                 {"version", no_argument, 0, 'V'},
37                 {"help", no_argument, 0, 'h'},
38                 {0, 0, 0, 0}
39 @@ -327,7 +329,7 @@
40  
41  
42         while (1) {
43 -               c = getopt_long (argc, argv, "+hVH:C:p:", longopts, &option);
44 +               c = getopt_long (argc, argv, "+hnVH:C:p:", longopts, &option);
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
68 @@ -437,5 +439,5 @@
69  print_usage (void)
70  {
71    printf ("%s\n", _("Usage:"));
72 -       printf ("%s -H host [-C community] [-p port]\n", progname);
73 +       printf ("%s -H host [-C community] [-p port] [-n]\n", progname);
74  }
This page took 0.219434 seconds and 3 git commands to generate.