[Nagiosplug-checkins] CVS: nagiosplug/plugins check_dig.c,1.12,1.13 check_pgsql.c,1.11,1.12 check_swap.c,1.13,1.14 check_tcp.c,1.29,1.30 utils.h,1.4,1.5

Karl DeBisschop kdebisschop at users.sourceforge.net
Tue Jul 29 21:08:20 CEST 2003


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

Modified Files:
	check_dig.c check_pgsql.c check_swap.c check_tcp.c utils.h 
Log Message:
markup for translation

Index: check_dig.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dig.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** check_dig.c	17 Apr 2003 05:55:25 -0000	1.12
--- check_dig.c	30 Jul 2003 04:07:53 -0000	1.13
***************
*** 17,59 ****
  *****************************************************************************/
  
  const char *progname = "check_dig";
  const char *revision = "$Revision$";
  const char *copyright = "2002-2003";
- const char *authors = "Nagios Plugin Development Team";
  const char *email = "nagiosplug-devel at lists.sourceforge.net";
  
! const char *summary = "Test the DNS service on the specified host using dig\n";
  
! const char *option_summary = "-H host -l lookup [-t timeout] [-v]";
  
! const char *options = "\
!  -H, --hostname=STRING or IPADDRESS\n\
!    Check server on the indicated host\n\
   -l, --lookup=STRING\n\
!    machine name to lookup\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";
! 
! const char *standard_options = "\
!  -h, --help\n\
!     Print detailed help screen\n\
!  -V, --version\n\
!     Print version information\n\n";
  
! #include "config.h"
! #include "common.h"
! #include "utils.h"
! #include "popen.h"
  
! int process_arguments (int, char **);
! int validate_arguments (void);
! void print_help (void);
! void print_usage (void);
  
  char *query_address = NULL;
  char *dns_server = NULL;
  int verbose = FALSE;
  
  int
--- 17,89 ----
  *****************************************************************************/
  
+ #include "config.h"
+ #include "common.h"
+ #include "netutils.h"
+ #include "utils.h"
+ #include "popen.h"
+ 
+ int process_arguments (int, char **);
+ int validate_arguments (void);
+ void print_help (void);
+ void print_usage (void);
+ 
  const char *progname = "check_dig";
  const char *revision = "$Revision$";
  const char *copyright = "2002-2003";
  const char *email = "nagiosplug-devel at lists.sourceforge.net";
  
! enum {
! 	DEFAULT_PORT = 53
! };
! 
! void
! print_usage (void)
! {
! 	printf (_("\
! Usage: %s -H host -l lookup [-p <server port>] [-w <warning interval>]\n\
!          [-c <critical interval>] [-t <timeout>] [-v]\n"),
! 	        progname);
! 	printf ("       %s (-h|--help)\n", progname);
! 	printf ("       %s (-V|--version)\n", progname);
! }
! 
! void
! print_help (void)
! {
! 	char *myport;
! 
! 	asprintf (&myport, "%d", DEFAULT_PORT);
! 
! 	print_revision (progname, revision);
  
! 	printf (_(COPYRIGHT), copyright, email);
  
! 	printf (_("Test the DNS service on the specified host using dig\n\n"));
! 
! 	print_usage ();
! 
! 	printf (_(HELP_VRSN));
! 
! 	printf (_(HOST_PORT), 'P', myport);
! 
! 	printf (_("\
   -l, --lookup=STRING\n\
!    machine name to lookup\n"));
  
! 	printf (_(WARN_CRIT_TO), DEFAULT_SOCKET_TIMEOUT);
  
! 	printf (_(VRBS));
! 
! 	support ();
! }
! 
  
  char *query_address = NULL;
  char *dns_server = NULL;
  int verbose = FALSE;
+ int server_port = DEFAULT_PORT;
+ int warning_interval = -1;
+ int critical_interval = -1;
+ 
  
  int
***************
*** 67,77 ****
  	/* Set signal handling and alarm */
  	if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR)
! 		usage ("Cannot catch SIGALRM\n");
  
  	if (process_arguments (argc, argv) != OK)
! 		usage ("Could not parse arguments\n");
  
  	/* get the command to run */
! 	asprintf (&command_line, "%s @%s %s", PATH_TO_DIG, dns_server, query_address);
  
  	alarm (timeout_interval);
--- 97,108 ----
  	/* Set signal handling and alarm */
  	if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR)
! 		usage (_("Cannot catch SIGALRM\n"));
  
  	if (process_arguments (argc, argv) != OK)
! 		usage (_("Could not parse arguments\n"));
  
  	/* get the command to run */
! 	asprintf (&command_line, "%s @%s -p %d %s",
! 	          PATH_TO_DIG, dns_server, server_port, query_address);
  
  	alarm (timeout_interval);
***************
*** 83,87 ****
  	child_process = spopen (command_line);
  	if (child_process == NULL) {
! 		printf ("Could not open pipe: %s\n", command_line);
  		return STATE_UNKNOWN;
  	}
--- 114,118 ----
  	child_process = spopen (command_line);
  	if (child_process == NULL) {
! 		printf (_("Could not open pipe: %s\n"), command_line);
  		return STATE_UNKNOWN;
  	}
***************
*** 89,93 ****
  	child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
  	if (child_stderr == NULL)
! 		printf ("Could not open stderr for %s\n", command_line);
  
  	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
--- 120,124 ----
  	child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
  	if (child_stderr == NULL)
! 		printf (_("Could not open stderr for %s\n"), command_line);
  
  	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
***************
*** 108,112 ****
  			}
  			else {
! 				asprintf (&output, "Server not found in ANSWER SECTION");
  				result = STATE_WARNING;
  			}
--- 139,143 ----
  			}
  			else {
! 				asprintf (&output, _("Server not found in ANSWER SECTION"));
  				result = STATE_WARNING;
  			}
***************
*** 118,122 ****
  
  	if (result != STATE_OK) {
! 		asprintf (&output, "No ANSWER SECTION found");
  	}
  
--- 149,153 ----
  
  	if (result != STATE_OK) {
! 		asprintf (&output, _("No ANSWER SECTION found"));
  	}
  
***************
*** 135,139 ****
  		result = max_state (result, STATE_WARNING);
  		if (strlen (output) == 0)
! 			asprintf (&output, "dig returned error status");
  	}
  
--- 166,170 ----
  		result = max_state (result, STATE_WARNING);
  		if (strlen (output) == 0)
! 			asprintf (&output, _("dig returned error status"));
  	}
  
***************
*** 141,155 ****
  
  	if (output == NULL || strlen (output) == 0)
! 		asprintf (&output, " Probably a non-existent host/domain");
  
  	if (result == STATE_OK)
! 		printf ("DNS OK - %d seconds response time (%s)\n",
  						(int) (end_time - start_time), output);
  	else if (result == STATE_WARNING)
! 		printf ("DNS WARNING - %s\n", output);
  	else if (result == STATE_CRITICAL)
! 		printf ("DNS CRITICAL - %s\n", output);
  	else
! 		printf ("DNS problem - %s\n", output);
  
  	return result;
--- 172,186 ----
  
  	if (output == NULL || strlen (output) == 0)
! 		asprintf (&output, _(" Probably a non-existent host/domain"));
  
  	if (result == STATE_OK)
! 		printf (_("DNS OK - %d seconds response time (%s)\n"),
  						(int) (end_time - start_time), output);
  	else if (result == STATE_WARNING)
! 		printf (_("DNS WARNING - %s\n"), output);
  	else if (result == STATE_CRITICAL)
! 		printf (_("DNS CRITICAL - %s\n"), output);
  	else
! 		printf (_("DNS problem - %s\n"), output);
  
  	return result;
***************
*** 183,187 ****
  		switch (c) {
  		case '?':									/* help */
! 			usage3 ("Unknown argument", optopt);
  		case 'H':									/* hostname */
  			if (is_host (optarg)) {
--- 214,224 ----
  		switch (c) {
  		case '?':									/* help */
! 			usage3 (_("Unknown argument"), optopt);
! 		case 'h':									/* help */
! 			print_help ();
! 			exit (STATE_OK);
! 		case 'V':									/* version */
! 			print_revision (progname, "$Revision$");
! 			exit (STATE_OK);
  		case 'H':									/* hostname */
  			if (is_host (optarg)) {
***************
*** 189,193 ****
  			}
  			else {
! 				usage ("Invalid host name\n");
  			}
  			break;
--- 226,238 ----
  			}
  			else {
! 				usage2 (_("Invalid host name"), optarg);
! 			}
! 			break;
! 		case 'p':
! 			if (is_intpos (optarg)) {
! 				server_port = atoi (optarg);
! 			}
! 			else {
! 				usage2 (_("Server port must be a nonnegative integer\n"), optarg);
  			}
  			break;
***************
*** 195,200 ****
  			query_address = optarg;
  			break;
! 		case 'v':									/* verbose */
! 			verbose = TRUE;
  			break;
  		case 't':									/* timeout */
--- 240,258 ----
  			query_address = optarg;
  			break;
! 		case 'w':									/* timeout */
! 			if (is_intnonneg (optarg)) {
! 				warning_interval = atoi (optarg);
! 			}
! 			else {
! 				usage2 (_("Warning interval must be a nonnegative integer\n"), optarg);
! 			}
! 			break;
! 		case 'c':									/* timeout */
! 			if (is_intnonneg (optarg)) {
! 				critical_interval = atoi (optarg);
! 			}
! 			else {
! 				usage2 (_("Critical interval must be a nonnegative integer\n"), optarg);
! 			}
  			break;
  		case 't':									/* timeout */
***************
*** 203,215 ****
  			}
  			else {
! 				usage ("Time interval must be a nonnegative integer\n");
  			}
  			break;
! 		case 'V':									/* version */
! 			print_revision (progname, "$Revision$");
! 			exit (STATE_OK);
! 		case 'h':									/* help */
! 			print_help ();
! 			exit (STATE_OK);
  		}
  	}
--- 261,270 ----
  			}
  			else {
! 				usage2 (_("Time interval must be a nonnegative integer\n"), optarg);
  			}
  			break;
! 		case 'v':									/* verbose */
! 			verbose = TRUE;
! 			break;
  		}
  	}
***************
*** 222,226 ****
  			}
  			else {
! 				usage ("Invalid host name");
  			}
  		}
--- 277,281 ----
  			}
  			else {
! 				usage2 (_("Invalid host name"), argv[c]);
  			}
  		}
***************
*** 243,272 ****
  }
  
- 
- 
- 
- 
- void
- print_help (void)
- {
- 	print_revision (progname, revision);
- 	printf ("Copyright (c) %s %s\n\t<%s>\n\n", copyright, authors, email);
- 	printf (summary);
- 	print_usage ();
- 	printf ("\nOptions:\n");
- 	printf (options, DEFAULT_SOCKET_TIMEOUT);
- 	printf (standard_options);
- 	support ();
- }
- 
- 
- 
- 
- 
- void
- print_usage (void)
- {
- 	printf ("Usage: %s %s\n", progname, option_summary);
- 	printf ("       %s (-h|--help)\n", progname);
- 	printf ("       %s (-V|--version)\n", progname);
- }
--- 298,299 ----

Index: check_pgsql.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_pgsql.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** check_pgsql.c	29 Jul 2003 11:58:16 -0000	1.11
--- check_pgsql.c	30 Jul 2003 04:07:53 -0000	1.12
***************
*** 30,35 ****
  	DEFAULT_PORT = 5432,
  	DEFAULT_WARN = 2,
! 	DEFAULT_CRIT = 8,
! 	DEFAULT_TIMEOUT = 30
  };
  
--- 30,34 ----
  	DEFAULT_PORT = 5432,
  	DEFAULT_WARN = 2,
! 	DEFAULT_CRIT = 8
  };
  
***************
*** 126,129 ****
--- 125,132 ----
  print_help (void)
  {
+ 	char *myport;
+ 
+ 	asprintf (&myport, "%d", DEFAULT_PORT);
+ 
  	print_revision (progname, revision);
  
***************
*** 136,140 ****
  	printf (_(HELP_VRSN));
  
! 	printf (_(HOST_PORT_46), 'P', "5432");
  
  	printf (S_("\
--- 139,145 ----
  	printf (_(HELP_VRSN));
  
! 	printf (_(HOST_PORT), 'P', myport);
! 
! 	printf (_(IPv46));
  
  	printf (S_("\
***************
*** 144,148 ****
      Login name of user\n\
    -p, --password = STRING\n\
!     Password (BIG SECURITY ISSUE)\n\n"), DEFAULT_DB);
  
  	printf (_(WARN_CRIT_TO), DEFAULT_SOCKET_TIMEOUT);
--- 149,153 ----
      Login name of user\n\
    -p, --password = STRING\n\
!     Password (BIG SECURITY ISSUE)\n"), DEFAULT_DB);
  
  	printf (_(WARN_CRIT_TO), DEFAULT_SOCKET_TIMEOUT);

Index: check_swap.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_swap.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** check_swap.c	29 Jul 2003 11:58:16 -0000	1.13
--- check_swap.c	30 Jul 2003 04:07:53 -0000	1.14
***************
*** 125,129 ****
  
  	if (process_arguments (argc, argv) != OK)
! 		usage ("Invalid command arguments supplied\n");
  
  #ifdef HAVE_PROC_MEMINFO
--- 125,129 ----
  
  	if (process_arguments (argc, argv) != OK)
! 		usage (_("Invalid command arguments supplied\n"));
  
  #ifdef HAVE_PROC_MEMINFO
***************
*** 148,158 ****
  
  	if (verbose >= 2)
! 		printf ("Command: %s\n", swap_command);
  	if (verbose >= 3)
! 		printf ("Format: %s\n", swap_format);
  
  	child_process = spopen (swap_command);
  	if (child_process == NULL) {
! 		printf ("Could not open pipe: %s\n", swap_command);
  		return STATE_UNKNOWN;
  	}
--- 148,158 ----
  
  	if (verbose >= 2)
! 		printf (_("Command: %s\n"), swap_command);
  	if (verbose >= 3)
! 		printf ("_(Format: %s\n"), swap_format);
  
  	child_process = spopen (swap_command);
  	if (child_process == NULL) {
! 		printf (_("Could not open pipe: %s\n"), swap_command);
  		return STATE_UNKNOWN;
  	}
***************
*** 160,164 ****
  	child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
  	if (child_stderr == NULL)
! 		printf ("Could not open stderr for %s\n", swap_command);
  
  	sprintf (str, "%s", "");
--- 160,164 ----
  	child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
  	if (child_stderr == NULL)
! 		printf (_("Could not open stderr for %s\n"), swap_command);
  
  	sprintf (str, "%s", "");
***************
*** 190,194 ****
  			dskfree = dskfree / conv_factor;
  			if (verbose >= 3)
! 				printf ("total=%d, free=%d\n", dsktotal, dskfree);
  
  			dskused = dsktotal - dskfree;
--- 190,194 ----
  			dskfree = dskfree / conv_factor;
  			if (verbose >= 3)
! 				printf (_("total=%d, free=%d\n"), dsktotal, dskfree);
  
  			dskused = dsktotal - dskfree;
***************
*** 207,211 ****
  	percent_used = 100 * ((double) used_swap) / ((double) total_swap);
  	result = max_state (result, check_swap (percent_used, free_swap));
! 	asprintf (&status, " %d%% free (%lu MB out of %lu MB)%s",
  						(100 - percent_used), free_swap, total_swap, status);
  
--- 207,211 ----
  	percent_used = 100 * ((double) used_swap) / ((double) total_swap);
  	result = max_state (result, check_swap (percent_used, free_swap));
! 	asprintf (&status, _(" %d%% free (%lu MB out of %lu MB)%s"),
  						(100 - percent_used), free_swap, total_swap, status);
  
***************
*** 295,299 ****
  			}
  			else {
! 				usage ("Warning threshold must be integer or percentage!\n");
  			}
  			wc++;
--- 295,299 ----
  			}
  			else {
! 				usage (_("Warning threshold must be integer or percentage!\n"));
  			}
  			wc++;
***************
*** 313,317 ****
  			}
  			else {
! 				usage ("Critical threshold must be integer or percentage!\n");
  			}
  			cc++;
--- 313,317 ----
  			}
  			else {
! 				usage (_("Critical threshold must be integer or percentage!\n"));
  			}
  			cc++;
***************
*** 329,333 ****
  			exit (STATE_OK);
  		case '?':									/* help */
! 			usage ("Invalid argument\n");
  		}
  	}
--- 329,333 ----
  			exit (STATE_OK);
  		case '?':									/* help */
! 			usage (_("Invalid argument\n"));
  		}
  	}
***************
*** 370,378 ****
  	else if (warn_percent < crit_percent) {
  		usage
! 			("Warning percentage should be more than critical percentage\n");
  	}
  	else if (warn_size < crit_size) {
  		usage
! 			("Warning free space should be more than critical free space\n");
  	}
  	return OK;
--- 370,378 ----
  	else if (warn_percent < crit_percent) {
  		usage
! 			(_("Warning percentage should be more than critical percentage\n"));
  	}
  	else if (warn_size < crit_size) {
  		usage
! 			(_("Warning free space should be more than critical free space\n"));
  	}
  	return OK;

Index: check_tcp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_tcp.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** check_tcp.c	29 Jul 2003 11:58:16 -0000	1.29
--- check_tcp.c	30 Jul 2003 04:07:53 -0000	1.30
***************
*** 119,123 ****
  	printf (_(HELP_VRSN));
  
! 	printf (_(HOST_PORT_46), 'p', "none");
  
  	printf (_("\
--- 119,125 ----
  	printf (_(HELP_VRSN));
  
! 	printf (_(HOST_PORT), 'p', "none");
! 
! 	printf (_(IPv46));
  
  	printf (_("\

Index: utils.h
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** utils.h	29 Jul 2003 11:57:36 -0000	1.4
--- utils.h	30 Jul 2003 04:07:53 -0000	1.5
***************
*** 100,108 ****
      Print version information\n"
  
! #define HOST_PORT_46 "\
   -H, --hostname=ADDRESS\n\
!     Host name or IP Address%s\n\
   -%c, --port=INTEGER\n\
!     Port number (default: %s)\n\
   -4, --use-ipv4\n\
      Use IPv4 connection\n\
--- 100,110 ----
      Print version information\n"
  
! #define HOST_PORT "\
   -H, --hostname=ADDRESS\n\
!     Host name or IP Address\n\
   -%c, --port=INTEGER\n\
!     Port number (default: %s)\n"
! 
! #define IPv46 "\
   -4, --use-ipv4\n\
      Use IPv4 connection\n\
***************
*** 120,122 ****
      Response time to result in critical status (seconds)\n\
   -t, --timeout=INTEGER\n\
!     Seconds before connection times out (default: %s)\n"
--- 122,124 ----
      Response time to result in critical status (seconds)\n\
   -t, --timeout=INTEGER\n\
!     Seconds before connection times out (default: %d)\n"





More information about the Commits mailing list