aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Sven Nierlein <sven@nierlein.org> 2019-01-04 22:56:36 +0100
committerGravatar GitHub <noreply@github.com> 2019-01-04 22:56:36 +0100
commit52373954332f517c4c52a8237dd20f5e91377128 (patch)
treef3000e2ad132a5d987ff4f3fc593b273ee021f4d
parentac6f101f057caa3083c092537e6dff97328cfd44 (diff)
parentf79f016238f436b94dfeb04c981de3a6d3e9d31c (diff)
downloadmonitoring-plugins-52373954332f517c4c52a8237dd20f5e91377128.tar.gz
Merge pull request #1569 from jacobbaungard/check_hpjd_disable_paper_out
check_hpjd: Added -D option to disable warning on 'out of paper'
-rw-r--r--plugins/check_hpjd.c12
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);
char *community = NULL;
char *address = NULL;
char *port = NULL;
+int check_paper_out = 1;
int
main (int argc, char **argv)
@@ -240,7 +241,8 @@ main (int argc, char **argv)
strcpy (errmsg, _("Paper Jam"));
}
else if (paper_out) {
- result = STATE_WARNING;
+ if (check_paper_out)
+ result = STATE_WARNING;
strcpy (errmsg, _("Out of Paper"));
}
else if (line_status == OFFLINE) {
@@ -325,7 +327,7 @@ process_arguments (int argc, char **argv)
while (1) {
- c = getopt_long (argc, argv, "+hVH:C:p:", longopts, &option);
+ c = getopt_long (argc, argv, "+hVH:C:p:D", longopts, &option);
if (c == -1 || c == EOF || c == 1)
break;
@@ -347,6 +349,8 @@ process_arguments (int argc, char **argv)
usage2 (_("Port must be a positive short integer"), optarg);
else
port = atoi(optarg);
+ case 'D': /* disable paper out check*/
+ check_paper_out = 0;
break;
case 'V': /* version */
print_revision (progname, NP_VERSION);
@@ -420,6 +424,8 @@ print_help (void)
printf (" %s", _("Specify the port to check "));
printf (_("(default=%s)"), DEFAULT_PORT);
printf ("\n");
+ printf (" %s\n", "-D");
+ printf (" %s", _("Disable paper check "));
printf (UT_SUPPORT);
}
@@ -430,5 +436,5 @@ void
print_usage (void)
{
printf ("%s\n", _("Usage:"));
- printf ("%s -H host [-C community] [-p port]\n", progname);
+ printf ("%s -H host [-C community] [-p port] [-D]\n", progname);
}