diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c
index 632237acd12a8018e37449c3b4970f51aa6c5c7e..51a0099ac281e9272a0e079dd96df0974af56b89 100644 (file)
--- a/plugins/check_hpjd.c
+++ b/plugins/check_hpjd.c
-/******************************************************************************
-*
-* This program is free software; you can redistribute it and/or modify
+/*****************************************************************************
+*
+* Nagios check_hpjd plugin
+*
+* License: GPL
+* Copyright (c) 2000-2007 Nagios Plugins Development Team
+*
+* Description:
+*
+* This file contains the check_hpjd plugin
+*
+* This plugin tests the STATUS of an HP printer with a JetDirect card.
+* Net-SNMP must be installed on the computer running the plugin.
+*
+*
+* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
+* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*
-* $Id$
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*
*****************************************************************************/
const char *progname = "check_hpjd";
-const char *revision = "$Revision$";
-const char *copyright = "2000-2006";
+const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ /* Parse extra opts if any */
+ argv=np_extra_opts (&argc, argv, progname);
+
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY);
/* get the command to run */
- sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community,
+ sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community,
address, query_string);
/* run the command */
strcpy (display_message, temp_buffer + 1);
break;
default: /* fold multiline message */
- strncat (display_message, input_buffer,
+ strncat (display_message, input_buffer,
sizeof (display_message) - strlen (display_message) - 1);
}
sprintf (errmsg, "%s", input_buffer );
}
-
+
/* close stderr */
(void) fclose (child_stderr);
/* might not be the problem, but most likely is. */
result = STATE_UNKNOWN ;
asprintf (&errmsg, "%s : Timeout from host %s\n", errmsg, address );
-
+
}
/* if we had no read errors, check the printer status results... */
if (argc < 2)
return ERROR;
-
+
while (1) {
c = getopt_long (argc, argv, "+hVH:C:", longopts, &option);
community = strscpy (community, optarg);
break;
case 'V': /* version */
- print_revision (progname, revision);
+ print_revision (progname, NP_VERSION);
exit (STATE_OK);
case 'h': /* help */
print_help ();
exit (STATE_OK);
case '?': /* help */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
}
}
usage2 (_("Invalid hostname/address"), argv[c]);
}
}
-
+
if (community == NULL) {
if (argv[c] != NULL )
community = argv[c];
void
print_help (void)
{
- print_revision (progname, revision);
+ print_revision (progname, NP_VERSION);
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
printf (COPYRIGHT, copyright, email);
printf ("%s\n", _("This plugin tests the STATUS of an HP printer with a JetDirect card."));
- printf ("%s\n", _("Net-snmp must be installed on the computer running the plugin."));
+ printf ("%s\n", _("Net-snmp must be installed on the computer running the plugin."));
+
+ printf ("\n\n");
- printf ("\n\n");
-
print_usage ();
- printf (_(UT_HELP_VRSN));
+ printf (UT_HELP_VRSN);
+ printf (UT_EXTRA_OPTS);
printf (" %s\n", "-C, --community=STRING");
- printf (" %s", _("The SNMP community name "));
- printf (_("(default=%s)"), DEFAULT_COMMUNITY);
+ printf (" %s", _("The SNMP community name "));
+ printf (_("(default=%s)"), DEFAULT_COMMUNITY);
+ printf ("\n");
- printf (_(UT_SUPPORT));
+ printf (UT_SUPPORT);
}
void
print_usage (void)
{
- printf (_("Usage:"));
+ printf ("%s\n", _("Usage:"));
printf ("%s -H host [-C community]\n", progname);
}