[Nagiosplug-checkins] CVS: nagiosplug/plugins check_ldap.c,1.11,1.12 check_nagios.c,1.7,1.8 check_radius.c,1.5,1.6 check_udp.c,1.7,1.8 check_ups.c,1.7,1.8 negate.c,1.9,1.10

Karl DeBisschop kdebisschop at users.sourceforge.net
Mon Aug 4 00:43:02 CEST 2003


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv10949

Modified Files:
	check_ldap.c check_nagios.c check_radius.c check_udp.c 
	check_ups.c negate.c 
Log Message:
markup for translation

Index: check_ldap.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ldap.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** check_ldap.c	3 Aug 2003 14:24:32 -0000	1.11
--- check_ldap.c	4 Aug 2003 07:42:24 -0000	1.12
***************
*** 89,92 ****
--- 89,96 ----
  	printf (_(UT_WARN_CRIT));
  
+ 	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+ 
+ 	printf (_(UT_VERBOSE));
+ 
  	printf (_(UT_SUPPORT));
  }

Index: check_nagios.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_nagios.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** check_nagios.c	7 Apr 2003 22:53:48 -0000	1.7
--- check_nagios.c	4 Aug 2003 07:42:24 -0000	1.8
***************
*** 1,29 ****
  /******************************************************************************
!  *
!  * CHECK_NAGIOS.C
!  *
!  * Program: Nagios process plugin for Nagios
!  * License: GPL
!  * Copyright (c) 1999 Ethan Galstad (nagios at nagios.org)
!  *
!  * $Id$
!  *
!  * License Information:
!  *
!  * 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
!  * (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.
!  *
!  *****************************************************************************/
  
  #include "common.h"
--- 1,24 ----
  /******************************************************************************
! 
!  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
!  (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.
! 
! ******************************************************************************/
! 
! const char *progname = "check_nagios";
! const char *revision = "$Revision$";
! const char *copyright = "1999-2003";
! const char *email = "nagiosplug-devel at lists.sourceforge.net";
  
  #include "common.h"
***************
*** 31,39 ****
  #include "utils.h"
  
! const char *progname = "check_nagios";
  
  int process_arguments (int, char **);
- void print_usage (void);
- void print_help (void);
  
  char *status_log = NULL;
--- 26,71 ----
  #include "utils.h"
  
! void
! print_usage (void)
! {
! 	printf (_("\
! Usage: %s -F <status log file> -e <expire_minutes> -C <process_string>\n"),
! 	        progname);
! }
  
+ void
+ print_help (void)
+ {
+ 	print_revision (progname, revision);
+ 
+ 	printf (_(COPYRIGHT), copyright, email);
+ 
+ 	printf (_("\
+ This plugin attempts to check the status of the Nagios process on the local\n\
+ machine. The plugin will check to make sure the Nagios status log is no older\n\
+ than the number of minutes specified by the <expire_minutes> option.  It also\n\
+ uses the /bin/ps command to check for a process matching whatever you specify\n\
+ by the <process_string> argument.\n"));
+ 
+ 	print_usage ();
+ 
+ 	printf (_(UT_HELP_VRSN));
+ 
+ 	printf (_("\
+ -F, --filename=FILE\n\
+    Name of the log file to check\n\
+ -e, --expires=INTEGER\n\
+    Seconds aging afterwhich logfile is condsidered stale\n\
+ -C, --command=STRING\n\
+    Command to search for in process table\n"));
+ 
+ 	printf (_("\
+ Example:\n\
+    ./check_nagios -e 5 \\\
+    -F /usr/local/nagios/var/status.log \\\
+    -C /usr/local/nagios/bin/nagios\n"));
+ }
+ 
  int process_arguments (int, char **);
  
  char *status_log = NULL;
***************
*** 65,73 ****
  
  	if (process_arguments (argc, argv) == ERROR)
! 		usage ("Could not parse arguments\n");
  
  	/* Set signal handling and alarm */
  	if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) {
! 		printf ("Cannot catch SIGALRM");
  		return STATE_UNKNOWN;
  	}
--- 97,105 ----
  
  	if (process_arguments (argc, argv) == ERROR)
! 		usage (_("Could not parse arguments\n"));
  
  	/* Set signal handling and alarm */
  	if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) {
! 		printf (_("Cannot catch SIGALRM"));
  		return STATE_UNKNOWN;
  	}
***************
*** 79,83 ****
  	fp = fopen (status_log, "r");
  	if (fp == NULL) {
! 		printf ("Error: Cannot open status log for reading!\n");
  		return STATE_CRITICAL;
  	}
--- 111,115 ----
  	fp = fopen (status_log, "r");
  	if (fp == NULL) {
! 		printf (_("Error: Cannot open status log for reading!\n"));
  		return STATE_CRITICAL;
  	}
***************
*** 96,100 ****
  	child_process = spopen (PS_COMMAND);
  	if (child_process == NULL) {
! 		printf ("Could not open pipe: %s\n", PS_COMMAND);
  		return STATE_UNKNOWN;
  	}
--- 128,132 ----
  	child_process = spopen (PS_COMMAND);
  	if (child_process == NULL) {
! 		printf (_("Could not open pipe: %s\n"), PS_COMMAND);
  		return STATE_UNKNOWN;
  	}
***************
*** 102,106 ****
  	child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
  	if (child_stderr == NULL) {
! 		printf ("Could not open stderr for %s\n", PS_COMMAND);
  	}
  
--- 134,138 ----
  	child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
  	if (child_stderr == NULL) {
! 		printf (_("Could not open stderr for %s\n"), PS_COMMAND);
  	}
  
***************
*** 117,121 ****
  				proc_entries++;
  				if (verbose)
! 					printf ("Found process: %s\n", procargs);
  			}
  		}
--- 149,153 ----
  				proc_entries++;
  				if (verbose)
! 					printf (_("Found process: %s\n"), procargs);
  			}
  		}
***************
*** 137,141 ****
  
  	if (proc_entries == 0) {
! 		printf ("Could not locate a running Nagios process!\n");
  		return STATE_CRITICAL;
  	}
--- 169,173 ----
  
  	if (proc_entries == 0) {
! 		printf (_("Could not locate a running Nagios process!\n"));
  		return STATE_CRITICAL;
  	}
***************
*** 144,152 ****
  
  	time (&current_time);
! 	if ((current_time - latest_entry_time) > (expire_minutes * 60))
  		result = STATE_WARNING;
  
  	printf
! 		("Nagios %s: located %d process%s, status log updated %d second%s ago\n",
  		 (result == STATE_OK) ? "ok" : "problem", proc_entries,
  		 (proc_entries == 1) ? "" : "es",
--- 176,184 ----
  
  	time (&current_time);
! 	if ((int)(current_time - latest_entry_time) > (expire_minutes * 60))
  		result = STATE_WARNING;
  
  	printf
! 		(_("Nagios %s: located %d process%s, status log updated %d second%s ago\n"),
  		 (result == STATE_OK) ? "ok" : "problem", proc_entries,
  		 (proc_entries == 1) ? "" : "es",
***************
*** 187,191 ****
  		else
  			terminate (STATE_UNKNOWN,
! 								 "Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n",
  								 progname);
  		process_string = argv[3];
--- 219,223 ----
  		else
  			terminate (STATE_UNKNOWN,
! 								 _("Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n"),
  								 progname);
  		process_string = argv[3];
***************
*** 201,205 ****
  		switch (c) {
  		case '?':									/* print short usage statement if args not parsable */
! 			printf ("%s: Unknown argument: %c\n\n", progname, optopt);
  			print_usage ();
  			exit (STATE_UNKNOWN);
--- 233,237 ----
  		switch (c) {
  		case '?':									/* print short usage statement if args not parsable */
! 			printf (_("%s: Unknown argument: %c\n\n"), progname, optopt);
  			print_usage ();
  			exit (STATE_UNKNOWN);
***************
*** 221,225 ****
  			else
  				terminate (STATE_UNKNOWN,
! 									 "Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n",
  									 progname);
  			break;
--- 253,257 ----
  			else
  				terminate (STATE_UNKNOWN,
! 									 _("Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n"),
  									 progname);
  			break;
***************
*** 233,287 ****
  	if (status_log == NULL)
  		terminate (STATE_UNKNOWN,
! 							 "You must provide the status_log\nType '%s -h' for additional help\n",
  							 progname);
  	else if (process_string == NULL)
  		terminate (STATE_UNKNOWN,
! 							 "You must provide a process string\nType '%s -h' for additional help\n",
  							 progname);
  
  	return OK;
- }
- 
- 
- 
- 
- 
- void
- print_usage (void)
- {
- 	printf
- 		("Usage: %s -F <status log file> -e <expire_minutes> -C <process_string>\n",
- 		 progname);
- }
- 
- 
- 
- 
- 
- void
- print_help (void)
- {
- 	print_revision (progname, "$Revision$");
- 	printf
- 		("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n"
- 		 "This plugin attempts to check the status of the Nagios process on the local\n"
- 		 "machine. The plugin will check to make sure the Nagios status log is no older\n"
- 		 "than the number of minutes specified by the <expire_minutes> option.  It also\n"
- 		 "uses the /bin/ps command to check for a process matching whatever you specify\n"
- 		 "by the <process_string> argument.\n");
- 	print_usage ();
- 	printf
- 		("\nOptions:\n"
- 		 "-F, --filename=FILE\n"
- 		 "   Name of the log file to check\n"
- 		 "-e, --expires=INTEGER\n"
- 		 "   Seconds aging afterwhich logfile is condsidered stale\n"
- 		 "-C, --command=STRING\n"
- 		 "   Command to search for in process table\n"
- 		 "-h, --help\n"
- 		 "   Print this help screen\n"
- 		 "-V, --version\n"
- 		 "   Print version information\n\n"
- 		 "Example:\n"
- 		 "   ./check_nagios -F /usr/local/nagios/var/status.log -e 5 -C /usr/local/nagios/bin/nagios\n");
  }
--- 265,275 ----
  	if (status_log == NULL)
  		terminate (STATE_UNKNOWN,
! 							 _("You must provide the status_log\nType '%s -h' for additional help\n"),
  							 progname);
  	else if (process_string == NULL)
  		terminate (STATE_UNKNOWN,
! 							 _("You must provide a process string\nType '%s -h' for additional help\n"),
  							 progname);
  
  	return OK;
  }

Index: check_radius.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_radius.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** check_radius.c	11 Mar 2003 22:22:11 -0000	1.5
--- check_radius.c	4 Aug 2003 07:42:24 -0000	1.6
***************
*** 1,44 ****
  /******************************************************************************
!  *
!  * Program: radius server check plugin for Nagios
!  * License: GPL
!  *
!  * License Information:
!  *
!  * 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
!  * (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$
!  *
!  *****************************************************************************/
  
  const char *progname = "check_radius";
! #define REVISION "$Revision$"
! #define COPYRIGHT "1999-2001"
! #define AUTHORS "Robert August Vincent II/Karl DeBisschop"
! #define EMAIL "kdebisschop at users.sourceforge.net"
! #define SUMMARY "Tests to see if a radius server is accepting connections.\n"
! 
! #define OPTIONS "\
! -H host -F config_file -u username -p password\'\
!               [-P port] [-t timeout] [-r retries] [-e expect]"
! 
! #define LONGOPTIONS "\
!  -H, --hostname=HOST\n\
!     Host name argument for servers using host headers (use numeric\n\
!     address if possible to bypass DNS lookup).\n\
!  -P, --port=INTEGER\n\
!     Port number (default: %d)\n\
   -u, --username=STRING\n\
      The user to authenticate\n\
--- 1,59 ----
  /******************************************************************************
! 
!  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
!  (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.
! 
!  ******************************************************************************/
  
  const char *progname = "check_radius";
! const char *revision = "$Revision$";
! const char *copyright = "2000-2003";
! const char *email = "nagiosplug-devel at lists.sourceforge.net";
! 
! #include "config.h"
! #include "common.h"
! #include "utils.h"
! #include <radiusclient.h>
! 
! void
! print_usage (void)
! {
! 	printf ("\
! Usage: %s -H host -F config_file -u username -p password [-P port]\n\
!   [-t timeout] [-r retries] [-e expect]\n", progname);
! 	printf (_(UT_HLP_VRS), progname, progname);
! }
! 
! void
! print_help (void)
! {
! 	char *myport;
! 	asprintf (&myport, "%d", PW_AUTH_UDP_PORT);
! 
! 	print_revision (progname, revision);
! 
! 	printf (_("Copyright (c) 1999 Robert August Vincent II\n"));
! 	printf (_(COPYRIGHT), copyright, email);
! 
! 	printf(_("Tests to see if a radius server is accepting connections.\n\n"));
! 
! 	print_usage ();
! 
! 	printf (_(UT_HELP_VRSN));
! 
! 	printf (_(UT_HOST_PORT), 'P', myport);
! 
! 	printf (_("\
   -u, --username=STRING\n\
      The user to authenticate\n\
***************
*** 50,70 ****
      Response string to expect from the server\n\
   -r, --retries=INTEGER\n\
!     Number of times to retry a failed connection\n\
!  -t, --timeout=INTEGER\n\
!     Seconds before connection times out (default: %d)\n\
!  -v, --verbose\n\
!     Show details for command-line debugging (do not use with nagios server)\n\
!  -h, --help\n\
!     Print detailed help screen\n\
!  -V, --version\n\
!     Print version information\n"
  
! #define DESCRIPTION "\
  This plugin tests a radius server to see if it is accepting connections.\n\
  \n\
  The server to test must be specified in the invocation, as well as a user\n\
  name and password. A configuration file may also be present. The format of\n\
! the configuration file is described in the radiusclient library sources.\n\
! \n\
  The password option presents a substantial security issue because the\n\
  password can be determined by careful watching of the command line in\n\
--- 65,80 ----
      Response string to expect from the server\n\
   -r, --retries=INTEGER\n\
!     Number of times to retry a failed connection\n"));
! 
! 	printf (_(UT_TIMEOUT), timeout_interval);
  
! 	printf (_("\n\
  This plugin tests a radius server to see if it is accepting connections.\n\
  \n\
  The server to test must be specified in the invocation, as well as a user\n\
  name and password. A configuration file may also be present. The format of\n\
! the configuration file is described in the radiusclient library sources.\n\n"));
! 
! 	printf (_("\
  The password option presents a substantial security issue because the\n\
  password can be determined by careful watching of the command line in\n\
***************
*** 72,95 ****
  run the plugin at regular prdictable intervals.  Please be sure that\n\
  the password used does not allow access to sensitive system resources,\n\
! otherwise compormise could occur.\n"
! 
! #include "config.h"
! #include "common.h"
! #include "utils.h"
! #include <radiusclient.h>
  
  int process_arguments (int, char **);
- void print_usage (void);
- void print_help (void);
  
  char *server = NULL;
- int port = PW_AUTH_UDP_PORT;
  char *username = NULL;
  char *password = NULL;
  char *expect = NULL;
  char *config_file = NULL;
  int retries = 1;
  int verbose = FALSE;
- 
  ENV *env = NULL;
  
--- 82,100 ----
  run the plugin at regular prdictable intervals.  Please be sure that\n\
  the password used does not allow access to sensitive system resources,\n\
! otherwise compormise could occur.\n"));
  
+ 	printf (_(UT_SUPPORT));
+ }
+ 
  int process_arguments (int, char **);
  
  char *server = NULL;
  char *username = NULL;
  char *password = NULL;
  char *expect = NULL;
  char *config_file = NULL;
+ int port = PW_AUTH_UDP_PORT;
  int retries = 1;
  int verbose = FALSE;
  ENV *env = NULL;
  
***************
*** 152,165 ****
  	UINT4 service;
  	char msg[BUFFER_LEN];
! 	SEND_DATA data = { 0 };
  	int result;
  	UINT4 client_id;
  
  	if (process_arguments (argc, argv) == ERROR)
! 		usage ("Could not parse arguments\n");
  
  	if ((config_file && rc_read_config (config_file)) ||
  			rc_read_dictionary (rc_conf_str ("dictionary")))
! 		terminate (STATE_UNKNOWN, "Config file error");
  
  	service = PW_AUTHENTICATE_ONLY;
--- 157,170 ----
  	UINT4 service;
  	char msg[BUFFER_LEN];
! 	SEND_DATA data;
  	int result;
  	UINT4 client_id;
  
  	if (process_arguments (argc, argv) == ERROR)
! 		usage (_("Could not parse arguments\n"));
  
  	if ((config_file && rc_read_config (config_file)) ||
  			rc_read_dictionary (rc_conf_str ("dictionary")))
! 		terminate (STATE_UNKNOWN, _("Config file error"));
  
  	service = PW_AUTHENTICATE_ONLY;
***************
*** 168,172 ****
  				rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) &&
  				rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0)))
! 		terminate (STATE_UNKNOWN, "Out of Memory?");
  
  	/* 
--- 173,177 ----
  				rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) &&
  				rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0)))
! 		terminate (STATE_UNKNOWN, _("Out of Memory?"));
  
  	/* 
***************
*** 189,201 ****
  
  	if (result == TIMEOUT_RC)
! 		terminate (STATE_CRITICAL, "Timeout");
  	if (result == ERROR_RC)
! 		terminate (STATE_CRITICAL, "Auth Error");
  	if (result == BADRESP_RC)
! 		terminate (STATE_WARNING, "Auth Failed");
  	if (expect && !strstr (msg, expect))
  		terminate (STATE_WARNING, msg);
  	if (result == OK_RC)
! 		terminate (STATE_OK, "Auth OK");
  	return (0);
  }
--- 194,206 ----
  
  	if (result == TIMEOUT_RC)
! 		terminate (STATE_CRITICAL, _("Timeout"));
  	if (result == ERROR_RC)
! 		terminate (STATE_CRITICAL, _("Auth Error"));
  	if (result == BADRESP_RC)
! 		terminate (STATE_WARNING, _("Auth Failed"));
  	if (expect && !strstr (msg, expect))
  		terminate (STATE_WARNING, msg);
  	if (result == OK_RC)
! 		terminate (STATE_OK, _("Auth OK"));
  	return (0);
  }
***************
*** 235,248 ****
  			timeout_interval = atoi (argv[4]);
  		else
! 			usage ("Timeout interval must be a positive integer");
  		if (is_intpos (argv[5]))
  			retries = atoi (argv[5]);
  		else
! 			usage ("Number of retries must be a positive integer");
  		server = argv[6];
  		if (is_intpos (argv[7]))
  			port = atoi (argv[7]);
  		else
! 			usage ("Server port must be a positive integer");
  		expect = argv[8];
  		return OK;
--- 240,253 ----
  			timeout_interval = atoi (argv[4]);
  		else
! 			usage (_("Timeout interval must be a positive integer"));
  		if (is_intpos (argv[5]))
  			retries = atoi (argv[5]);
  		else
! 			usage (_("Number of retries must be a positive integer"));
  		server = argv[6];
  		if (is_intpos (argv[7]))
  			port = atoi (argv[7]);
  		else
! 			usage (_("Server port must be a positive integer"));
  		expect = argv[8];
  		return OK;
***************
*** 258,262 ****
  		switch (c) {
  		case '?':									/* print short usage statement if args not parsable */
! 			printf ("%s: Unknown argument: %s\n\n", progname, optarg);
  			print_usage ();
  			exit (STATE_UNKNOWN);
--- 263,267 ----
  		switch (c) {
  		case '?':									/* print short usage statement if args not parsable */
! 			printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
  			print_usage ();
  			exit (STATE_UNKNOWN);
***************
*** 265,269 ****
  			exit (OK);
  		case 'V':									/* version */
! 			print_revision (progname, "$Revision$");
  			exit (OK);
  		case 'v':									/* verbose mode */
--- 270,274 ----
  			exit (OK);
  		case 'V':									/* version */
! 			print_revision (progname, revision);
  			exit (OK);
  		case 'v':									/* verbose mode */
***************
*** 272,276 ****
  		case 'H':									/* hostname */
  			if (is_host (optarg) == FALSE) {
! 				printf ("Invalid host name/address\n\n");
  				print_usage ();
  				exit (STATE_UNKNOWN);
--- 277,281 ----
  		case 'H':									/* hostname */
  			if (is_host (optarg) == FALSE) {
! 				printf (_("Invalid host name/address\n\n"));
  				print_usage ();
  				exit (STATE_UNKNOWN);
***************
*** 282,286 ****
  				port = atoi (optarg);
  			else
! 				usage ("Server port must be a positive integer");
  			break;
  		case 'u':									/* username */
--- 287,291 ----
  				port = atoi (optarg);
  			else
! 				usage (_("Server port must be a positive integer"));
  			break;
  		case 'u':									/* username */
***************
*** 300,304 ****
  				retries = atoi (optarg);
  			else
! 				usage ("Number of retries must be a positive integer");
  			break;
  		case 't':									/* timeout */
--- 305,309 ----
  				retries = atoi (optarg);
  			else
! 				usage (_("Number of retries must be a positive integer"));
  			break;
  		case 't':									/* timeout */
***************
*** 306,339 ****
  				timeout_interval = atoi (optarg);
  			else
! 				usage ("Timeout interval must be a positive integer");
  			break;
  		}
  	}
  	return OK;
- }
- 
- 
- 
- void
- print_help (void)
- {
- 	print_revision (progname, REVISION);
- 	printf
- 		("Copyright (c) %s %s <%s>\n\n%s\n",
- 		 COPYRIGHT, AUTHORS, EMAIL, SUMMARY);
- 	print_usage ();
- 	printf
- 		("\nOptions:\n" LONGOPTIONS "\n" DESCRIPTION "\n", 
- 		 port, timeout_interval);
- 	support ();
- }
- 
- 
- void
- print_usage (void)
- {
- 	printf ("Usage:\n" " %s %s\n"
- 					" %s (-h | --help) for detailed help\n"
- 					" %s (-V | --version) for version information\n",
- 					progname, OPTIONS, progname, progname);
  }
--- 311,318 ----
  				timeout_interval = atoi (optarg);
  			else
! 				usage (_("Timeout interval must be a positive integer"));
  			break;
  		}
  	}
  	return OK;
  }

Index: check_udp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_udp.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** check_udp.c	12 Mar 2003 02:24:25 -0000	1.7
--- check_udp.c	4 Aug 2003 07:42:24 -0000	1.8
***************
*** 1,46 ****
  /******************************************************************************
! *
! * CHECK_UDP.C
! *
! * Program: UDP port plugin for Nagios
! * License: GPL
! * Copyright (c) 1999 Ethan Galstad (nagios at nagios.org)
! *
! * Last Modified: $Date$
! *
! * Command line: CHECK_UDP <host_address> [-p port] [-s send] [-e expect] \
! *			   [-wt warn_time] [-ct crit_time] [-to to_sec]
! *
! * Description:
! *
! * This plugin will attempt to connect to the specified port
! * on the host.  Successul connects return STATE_OK, refusals
! * and timeouts return STATE_CRITICAL, other errors return
! * STATE_UNKNOWN.
! *
! * License Information:
! *
! * 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
! * (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.
! *
  *****************************************************************************/
  
! #include "config.h"
  #include "common.h"
  #include "netutils.h"
  #include "utils.h"
  
! const char *progname = "check_udp";
  
  int warning_time = 0;
--- 1,78 ----
  /******************************************************************************
! 
!  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
!  (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.
! 
  *****************************************************************************/
  
! const char *progname = "check_udp";
! const char *revision = "$Revision$";
! const char *copyright = "1999-2002";
! const char *email = "nagiosplug-devel at lists.sourceforge.net";
! 
  #include "common.h"
  #include "netutils.h"
  #include "utils.h"
  
! /* Original Command line: 
!    check_udp <host_address> [-p port] [-s send] [-e expect] \
!    [-wt warn_time] [-ct crit_time] [-to to_sec] */
! void
! print_usage (void)
! {
! 	printf (_("\
! Usage: %s -H <host_address> [-p port] [-w warn_time] [-c crit_time]\n\
!     [-e expect] [-s send] [-t to_sec] [-v]\n"), progname);
! }
! 
! void
! print_help (void)
! {
! 	print_revision (progname, revision);
! 
! 	printf (_("Copyright (c) 1999 Ethan Galstad\n"));
! 	printf (_(COPYRIGHT), copyright, email);
! 
! 	printf (_("\
! This plugin tests an UDP connection with the specified host.\n\n"));
! 
! 	print_usage ();
! 
! 	printf (_(UT_HELP_VRSN));
! 
! 	printf (_(UT_HOST_PORT), 'p', "none");
! 
! 	printf (_("\
!  -e, --expect=STRING <optional>\n\
!     String to expect in first line of server response\n\
!  -s, --send=STRING <optional>\n\
!     String to send to the server when initiating the connection\n"));
! 
! 	printf (_(UT_WARN_CRIT));
! 
! 	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
! 
! 	printf (_(UT_VERBOSE));
! 
! 	printf (_("\
! This plugin will attempt to connect to the specified port on the host.\n\
! Successful connects return STATE_OK, refusals and timeouts return\n\
! STATE_CRITICAL, other errors return STATE_UNKNOWN.\n\n"));
! 
! 	printf(_(UT_SUPPORT));
! }
! 
! int process_arguments (int, char **);
  
  int warning_time = 0;
***************
*** 48,56 ****
  int critical_time = 0;
  int check_critical_time = FALSE;
- 
- int process_arguments (int, char **);
- void print_usage (void);
- void print_help (void);
- 
  int verbose = FALSE;
  int server_port = 0;
--- 80,83 ----
***************
*** 105,110 ****
  				STATE_WARNING;
  
! 		printf ("Connection %s on port %d - %d second response time\n",
! 						(result == STATE_OK) ? "accepted" : "problem", server_port,
  						(int) (end_time - start_time));
  	}
--- 132,137 ----
  				STATE_WARNING;
  
! 		printf (_("Connection %s on port %d - %d second response time\n"),
! 						(result == STATE_OK) ? _("accepted") : _("problem"), server_port,
  						(int) (end_time - start_time));
  	}
***************
*** 160,164 ****
  		switch (c) {
  		case '?':									/* print short usage statement if args not parsable */
! 			printf ("%s: Unknown argument: %s\n\n", progname, optarg);
  			print_usage ();
  			exit (STATE_UNKNOWN);
--- 187,191 ----
  		switch (c) {
  		case '?':									/* print short usage statement if args not parsable */
! 			printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
  			print_usage ();
  			exit (STATE_UNKNOWN);
***************
*** 167,171 ****
  			exit (STATE_OK);
  		case 'V':									/* version */
! 			print_revision (progname, "$Revision$");
  			exit (STATE_OK);
  		case 'v':									/* verbose mode */
--- 194,198 ----
  			exit (STATE_OK);
  		case 'V':									/* version */
! 			print_revision (progname, revision);
  			exit (STATE_OK);
  		case 'v':									/* verbose mode */
***************
*** 174,183 ****
  		case 'H':									/* hostname */
  			if (is_host (optarg) == FALSE)
! 				usage ("Invalid host name/address\n");
  			server_address = optarg;
  			break;
  		case 'c':									/* critical */
  			if (!is_intnonneg (optarg))
! 				usage ("Critical threshold must be a nonnegative integer\n");
  			critical_time = atoi (optarg);
  			check_critical_time = TRUE;
--- 201,210 ----
  		case 'H':									/* hostname */
  			if (is_host (optarg) == FALSE)
! 				usage (_("Invalid host name/address\n"));
  			server_address = optarg;
  			break;
  		case 'c':									/* critical */
  			if (!is_intnonneg (optarg))
! 				usage (_("Critical threshold must be a nonnegative integer\n"));
  			critical_time = atoi (optarg);
  			check_critical_time = TRUE;
***************
*** 185,189 ****
  		case 'w':									/* warning */
  			if (!is_intnonneg (optarg))
! 				usage ("Warning threshold must be a nonnegative integer\n");
  			warning_time = atoi (optarg);
  			check_warning_time = TRUE;
--- 212,216 ----
  		case 'w':									/* warning */
  			if (!is_intnonneg (optarg))
! 				usage (_("Warning threshold must be a nonnegative integer\n"));
  			warning_time = atoi (optarg);
  			check_warning_time = TRUE;
***************
*** 191,200 ****
  		case 't':									/* timeout */
  			if (!is_intnonneg (optarg))
! 				usage ("Timeout interval must be a nonnegative integer\n");
  			socket_timeout = atoi (optarg);
  			break;
  		case 'p':									/* port */
  			if (!is_intnonneg (optarg))
! 				usage ("Serevr port must be a nonnegative integer\n");
  			server_port = atoi (optarg);
  			break;
--- 218,227 ----
  		case 't':									/* timeout */
  			if (!is_intnonneg (optarg))
! 				usage (_("Timeout interval must be a nonnegative integer\n"));
  			socket_timeout = atoi (optarg);
  			break;
  		case 'p':									/* port */
  			if (!is_intnonneg (optarg))
! 				usage (_("Server port must be a nonnegative integer\n"));
  			server_port = atoi (optarg);
  			break;
***************
*** 211,270 ****
  	if (server_address == NULL && c < argc && argv[c]) {
  		if (is_host (argv[c]) == FALSE)
! 			usage ("Invalid host name/address\n");
  		server_address = argv[c++];
  	}
  
  	if (server_address == NULL)
! 		usage ("Host name was not supplied\n");
  
  	return c;
- }
- 
- 
- 
- 
- 
- void
- print_usage (void)
- {
- 	printf
- 		("Usage: %s -H <host_address> [-p port] [-w warn_time] [-c crit_time]\n"
- 		 "         [-e expect] [-s send] [-t to_sec] [-v]\n", progname);
- }
- 
- 
- 
- 
- 
- void
- print_help (void)
- {
- 	print_revision (progname, "$Revision$");
- 	printf
- 		("Copyright (c) 1999 Ethan Galstad (nagios at nagios.org)\n\n"
- 		 "This plugin tests an UDP connection with the specified host.\n\n");
- 	print_usage ();
- 	printf
- 		("Options:\n"
- 		 " -H, --hostname=ADDRESS\n"
- 		 "    Host name argument for servers using host headers (use numeric\n"
- 		 "    address if possible to bypass DNS lookup).\n"
- 		 " -p, --port=INTEGER\n"
- 		 "    Port number\n"
- 		 " -e, --expect=STRING <optional>\n"
- 		 "    String to expect in first line of server response\n"
- 		 " -s, --send=STRING <optional>\n"
- 		 "    String to send to the server when initiating the connection\n"
- 		 " -w, --warning=INTEGER <optional>\n"
- 		 "    Response time to result in warning status (seconds)\n"
- 		 " -c, --critical=INTEGER <optional>\n"
- 		 "    Response time to result in critical status (seconds)\n"
- 		 " -t, --timeout=INTEGER <optional>\n"
- 		 "    Seconds before connection times out (default: %d)\n"
- 		 " -v, --verbose <optional>\n"
- 		 "    Show details for command-line debugging (do not use with nagios server)\n"
- 		 " -h, --help\n"
- 		 "    Print detailed help screen and exit\n"
- 		 " -V, --version\n"
- 		 "    Print version information and exit\n", DEFAULT_SOCKET_TIMEOUT);
  }
--- 238,248 ----
  	if (server_address == NULL && c < argc && argv[c]) {
  		if (is_host (argv[c]) == FALSE)
! 			usage (_("Invalid host name/address\n"));
  		server_address = argv[c++];
  	}
  
  	if (server_address == NULL)
! 		usage (_("Host name was not supplied\n"));
  
  	return c;
  }

Index: check_ups.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ups.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** check_ups.c	11 Mar 2003 22:22:12 -0000	1.7
--- check_ups.c	4 Aug 2003 07:42:24 -0000	1.8
***************
*** 1,69 ****
  /******************************************************************************
! *
! * CHECK_UPS.C
! *
! * Program: UPS monitor plugin for Nagios
! * License: GPL
! * Copyright (c) 1999 Ethan Galstad (nagios at nagios.org)
! *
! * Last Modified: $Date$
! *
! * Command line: CHECK_UPS <host_address> [-u ups] [-p port] [-v variable] \
! *			   [-wv warn_value] [-cv crit_value] [-to to_sec]
! *
! * Description:
! *
! 
! * This plugin attempts to determine the status of an UPS
! * (Uninterruptible Power Supply) on a remote host (or the local host)
! * that is being monitored with Russel Kroll's "Smarty UPS Tools"
! * package. If the UPS is online or calibrating, the plugin will
! * return an OK state. If the battery is on it will return a WARNING
! * state.  If the UPS is off or has a low battery the plugin will
! * return a CRITICAL state.  You may also specify a variable to check
! * (such as temperature, utility voltage, battery load, etc.)  as well
! * as warning and critical thresholds for the value of that variable.
! * If the remote host has multiple UPS that are being monitored you
! * will have to use the [ups] option to specify which UPS to check.
! *
! * Notes:
! *
! * This plugin requires that the UPSD daemon distributed with Russel
! * Kroll's "Smart UPS Tools" be installed on the remote host.  If you
! * don't have the package installed on your system, you can download
! * it from http://www.exploits.org/nut
! *
! * License Information:
! *
! * 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
! * (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.
! *
  ******************************************************************************/
  
! #include "config.h"
  #include "common.h"
  #include "netutils.h"
  #include "utils.h"
  
! const char *progname = "check_ups";
! #define REVISION "$Revision$"
! #define COPYRIGHT "1999-2002"
! #define AUTHOR "Ethan Galstad"
! #define EMAIL "nagios at nagios.org"
  
! #define CHECK_NONE	0
  
! #define PORT     3493
  
  #define UPS_NONE     0   /* no supported options */
--- 1,96 ----
  /******************************************************************************
! 
!  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 (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.
! 
  ******************************************************************************/
  
! const char *progname = "check_ups";
! const char *revision = "$Revision$";
! const char *copyright = "2000-2002";
! const char *email = "nagiosplug-devel at lists.sourceforge.net";
! 
  #include "common.h"
  #include "netutils.h"
  #include "utils.h"
  
! enum {
! 	PORT = 3493
! };
! 
! void
! print_usage (void)
! {
! 	printf (_("\
! Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n\
!     [-t timeout] [-v]\n"), progname);
! 	printf (_(UT_HLP_VRS), progname, progname);
! }
! 
! void
! print_help (void)
! {
! 	char *myport;
! 	asprintf (&myport, "%d", PORT);
! 
! 	print_revision (progname, revision);
! 
! 	printf (_("Copyright (c) 2000 Tom Shields"));
! 	printf (_(COPYRIGHT), copyright, email);
! 
! 	printf (_("This plugin tests the UPS service on the specified host.\n\
! Network UPS Tools from www.exploits.org must be running for this plugin to\n\
! work.\n\n"));
! 
! 	print_usage ();
! 
! 	printf (_(UT_HELP_VRSN));
! 
! 	printf (_(UT_HOST_PORT), 'p', myport);
! 
! 	printf (_("\
!  -u, --ups=STRING\n\
!     Name of UPS\n"));
! 
! 	printf (_(UT_WARN_CRIT));
! 
! 	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
  
! 	printf (_(UT_VERBOSE));
  
! 	printf (_("\
! This plugin attempts to determine the status of a UPS (Uninterruptible Power\n\
! Supply) on a local or remote host. If the UPS is online or calibrating, the\n\
! plugin will return an OK state. If the battery is on it will return a WARNING\n\
! state.  If the UPS is off or has a low battery the plugin will return a CRITICAL\n\
! state.\n\n"));
! 
! 	printf (_("\
! You may also specify a variable to check [such as temperature, utility voltage,\n\
! battery load, etc.]  as well as warning and critical thresholds for the value of\n\
! that variable.  If the remote host has multiple UPS that are being monitored you\n\
! will have to use the [ups] option to specify which UPS to check.\n\n"));
! 
! 	printf (_("Notes:\n\n\
! This plugin requires that the UPSD daemon distributed with Russel Kroll's\n\
! Smart UPS Tools be installed on the remote host.  If you do not have the\n\
! package installed on your system, you can download it from\n\
! http://www.exploits.org/nut\n\n"));
! 
! 	printf (_(UT_SUPPORT));
! }
! 
! #define CHECK_NONE	 0
  
  #define UPS_NONE     0   /* no supported options */
***************
*** 86,91 ****
  char *server_address = "127.0.0.1";
  char *ups_name = NULL;
! double warning_value = 0.0L;
! double critical_value = 0.0L;
  int check_warning_value = FALSE;
  int check_critical_value = FALSE;
--- 113,118 ----
  char *server_address = "127.0.0.1";
  char *ups_name = NULL;
! double warning_value = 0.0;
! double critical_value = 0.0;
  int check_warning_value = FALSE;
  int check_critical_value = FALSE;
***************
*** 94,101 ****
  int status = UPSSTATUS_NONE;
  
! double ups_utility_voltage = 0.0L;
! double ups_battery_percent = 0.0L;
! double ups_load_percent = 0.0L;
! double ups_temperature = 0.0L;
  char *ups_status = "N/A";
  
--- 121,128 ----
  int status = UPSSTATUS_NONE;
  
! double ups_utility_voltage = 0.0;
! double ups_battery_percent = 0.0;
! double ups_load_percent = 0.0;
! double ups_temperature = 0.0;
  char *ups_status = "N/A";
  
***************
*** 106,111 ****
  int process_arguments (int, char **);
  int validate_arguments (void);
- void print_help (void);
- void print_usage (void);
  
  int
--- 133,136 ----
***************
*** 116,120 ****
  	char temp_buffer[MAX_INPUT_BUFFER];
  
! 	double ups_utility_deviation = 0.0L;
  
  	if (process_arguments (argc, argv) != OK)
--- 141,145 ----
  	char temp_buffer[MAX_INPUT_BUFFER];
  
! 	double ups_utility_deviation = 0.0;
  
  	if (process_arguments (argc, argv) != OK)
***************
*** 556,608 ****
  {
  	return OK;
- }
- 
- 
- 
- 
- 
- void
- print_help (void)
- {
- 	print_revision (progname, "$Revision$");
- 	printf
- 		("Copyright (c) 2000 Tom Shields/Karl DeBisschop\n\n"
- 		 "This plugin tests the UPS service on the specified host.\n"
- 		 "Newtork UPS Tools for www.exploits.org must be running for this plugin to work.\n\n");
- 	print_usage ();
- 	printf
- 		("\nOptions:\n"
- 		 " -H, --hostname=STRING or IPADDRESS\n"
- 		 "   Check server on the indicated host\n"
- 		 " -p, --port=INTEGER\n"
- 		 "   Make connection on the indicated port (default: %d)\n"
- 		 " -u, --ups=STRING\n"
- 		 "   Name of UPS\n"
- 		 " -w, --warning=INTEGER\n"
- 		 "   Seconds necessary to result in a warning status\n"
- 		 " -c, --critical=INTEGER\n"
- 		 "   Seconds necessary to result in a critical status\n"
- 		 " -t, --timeout=INTEGER\n"
- 		 "   Seconds before connection attempt times out (default: %d)\n"
- 		 " -v, --verbose\n"
- 		 "   Print extra information (command-line use only)\n"
- 		 " -h, --help\n"
- 		 "   Print detailed help screen\n"
- 		 " -V, --version\n"
- 		 "   Print version information\n\n", PORT, DEFAULT_SOCKET_TIMEOUT);
- 	support ();
- }
- 
- 
- 
- 
- 
- void
- print_usage (void)
- {
- 	printf
- 		("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n"
- 		 "            [-t timeout] [-v]\n"
- 		 "       %s --help\n"
- 		 "       %s --version\n", progname, progname, progname);
  }
--- 581,583 ----

Index: negate.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/negate.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** negate.c	14 May 2003 23:17:16 -0000	1.9
--- negate.c	4 Aug 2003 07:42:24 -0000	1.10
***************
*** 1,67 ****
  /******************************************************************************
!  *
!  * Program: Inverting plugin wrapper for Nagios
!  * License: GPL
!  *
!  * License Information:
!  *
!  * 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
!  * (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$
!  *
!  *****************************************************************************/
  
  const char *progname = "negate";
! #define REVISION "$Revision$"
! #define COPYRIGHT "2002"
! #define AUTHOR "Karl DeBisschop"
! #define EMAIL "kdebisschop at users.sourceforge.net"
! #define SUMMARY "Negates the status of a plugin (returns OK for CRITICAL, and vice-versa).\n"
! 
! #define OPTIONS "\
! [-t timeout] <definition of wrapped plugin>"
! 
! #define LONGOPTIONS "\
!   -t, --timeout=INTEGER\n\
!     Terminate test if timeout limit is exceeded (default: %d)\n\
!      [keep this less than the plugin timeout to retain CRITICAL status]\n"
  
! #define EXAMPLES "\
    negate \"/usr/local/nagios/libexec/check_ping -H host\"\n\
      Run check_ping and invert result. Must use full path to plugin\n\
    negate \"/usr/local/nagios/libexec/check_procs -a 'vi negate.c'\"\n\
!     Use single quotes if you need to retain spaces\n"
  
! #define DESCRIPTION "\
  This plugin is a wrapper to take the output of another plugin and invert it.\n\
  If the wrapped plugin returns STATE_OK, the wrapper will return STATE_CRITICAL.\n\
  If the wrapped plugin returns STATE_CRITICAL, the wrapper will return STATE_OK.\n\
! Otherwise, the output state of the wrapped plugin is unchanged.\n"
! 
! #define DEFAULT_TIMEOUT 9
! 
! #include "common.h"
! #include "utils.h"
! #include "popen.h"
  
  char *command_line;
  
  int process_arguments (int, char **);
  int validate_arguments (void);
- void print_usage (void);
- void print_help (void);
- 
  /******************************************************************************
  
--- 1,78 ----
  /******************************************************************************
! 
!  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
!  (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.
! 
! ******************************************************************************/
  
  const char *progname = "negate";
! const char *revision = "$Revision$";
! const char *copyright = "2002-2003";
! const char *email = "nagiosplug-devel at lists.sourceforge.net";
! 
! #define DEFAULT_TIMEOUT 9
! 
! #include "common.h"
! #include "utils.h"
! #include "popen.h"
! 
! void
! print_usage (void)
! {
! 	printf (_("Usage: %s [-t timeout] <definition of wrapped plugin>\n"),
! 	        progname);
! 	printf (_(UT_HLP_VRS), progname, progname);
! }
! 
! void
! print_help (void)
! {
! 	print_revision (progname, revision);
! 
! 	printf (_(COPYRIGHT), copyright, email);
! 
! 	printf (_("\
! Negates the status of a plugin (returns OK for CRITICAL, and vice-versa).\n\
! \n"));
! 
! 	print_usage ();
! 
! 	printf (_(UT_HELP_VRSN));
! 
! 	printf (_(UT_TIMEOUT), DEFAULT_TIMEOUT);
  
! 	printf (_("\
!      [keep timeout than the plugin timeout to retain CRITICAL status]\n"));
! 
! 	printf (_("\
    negate \"/usr/local/nagios/libexec/check_ping -H host\"\n\
      Run check_ping and invert result. Must use full path to plugin\n\
    negate \"/usr/local/nagios/libexec/check_procs -a 'vi negate.c'\"\n\
!     Use single quotes if you need to retain spaces\n"));
  
! 	printf (_("\
  This plugin is a wrapper to take the output of another plugin and invert it.\n\
  If the wrapped plugin returns STATE_OK, the wrapper will return STATE_CRITICAL.\n\
  If the wrapped plugin returns STATE_CRITICAL, the wrapper will return STATE_OK.\n\
! Otherwise, the output state of the wrapped plugin is unchanged.\n"));
  
+ 	printf (_(UT_SUPPORT));
+ }
+ 
  char *command_line;
  
  int process_arguments (int, char **);
  int validate_arguments (void);
  /******************************************************************************
  
***************
*** 124,132 ****
  
  	if (process_arguments (argc, argv) == ERROR)
! 		usage ("Could not parse arguments\n");
  
  	/* Set signal handling and alarm */
  	if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR)
! 		terminate (STATE_UNKNOWN, "Cannot catch SIGALRM");
  
  	(void) alarm ((unsigned) timeout_interval);
--- 135,143 ----
  
  	if (process_arguments (argc, argv) == ERROR)
! 		usage (_("Could not parse arguments\n"));
  
  	/* Set signal handling and alarm */
  	if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR)
! 		terminate (STATE_UNKNOWN, _("Cannot catch SIGALRM"));
  
  	(void) alarm ((unsigned) timeout_interval);
***************
*** 134,142 ****
  	child_process = spopen (command_line);
  	if (child_process == NULL)
! 		terminate (STATE_UNKNOWN, "Could not open pipe: %s\n", command_line);
  
  	child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
  	if (child_stderr == NULL) {
! 		printf ("Could not open stderr for %s\n", command_line);
  	}
  
--- 145,153 ----
  	child_process = spopen (command_line);
  	if (child_process == NULL)
! 		terminate (STATE_UNKNOWN, _("Could not open pipe: %s\n"), command_line);
  
  	child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
  	if (child_stderr == NULL) {
! 		printf (_("Could not open stderr for %s\n"), command_line);
  	}
  
***************
*** 154,158 ****
  	if (!found)
  		terminate (STATE_UNKNOWN,\
! 		           "%s problem - No data recieved from host\nCMD: %s\n",\
  		           argv[0],	command_line);
  
--- 165,169 ----
  	if (!found)
  		terminate (STATE_UNKNOWN,\
! 		           _("%s problem - No data recieved from host\nCMD: %s\n"),\
  		           argv[0],	command_line);
  
***************
*** 177,206 ****
  
  
- 
- void
- print_help (void)
- {
- 	print_revision (progname, REVISION);
- 	printf
- 		("Copyright (c) %s %s <%s>\n\n%s\n",
- 		 COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
- 	print_usage ();
- 	printf
- 		("\nOptions:\n" LONGOPTIONS "\n" "Examples:\n" EXAMPLES "\n"
- 		 DESCRIPTION "\n", DEFAULT_TIMEOUT);
- 	support ();
- }
- 
- void
- print_usage (void)
- {
- 	printf ("Usage:\n" " %s %s\n"
- 					" %s (-h | --help) for detailed help\n"
- 					" %s (-V | --version) for version information\n",
- 					progname, OPTIONS, progname, progname);
- }
- 
- 
- 
  /******************************************************************************
  @@-
--- 188,191 ----
***************
*** 241,254 ****
  		switch (c) {
  		case '?':     /* help */
! 			usage3 ("Unknown argument", optopt);
  		case 'h':     /* help */
  			print_help ();
  			exit (EXIT_SUCCESS);
  		case 'V':     /* version */
! 			print_revision (progname, REVISION);
  			exit (EXIT_SUCCESS);
  		case 't':     /* timeout period */
  			if (!is_integer (optarg))
! 				usage2 ("Timeout Interval must be an integer", optarg);
  			timeout_interval = atoi (optarg);
  			break;
--- 226,239 ----
  		switch (c) {
  		case '?':     /* help */
! 			usage3 (_("Unknown argument"), optopt);
  		case 'h':     /* help */
  			print_help ();
  			exit (EXIT_SUCCESS);
  		case 'V':     /* version */
! 			print_revision (progname, revision);
  			exit (EXIT_SUCCESS);
  		case 't':     /* timeout period */
  			if (!is_integer (optarg))
! 				usage2 (_("Timeout Interval must be an integer"), optarg);
  			timeout_interval = atoi (optarg);
  			break;





More information about the Commits mailing list