[Nagiosplug-checkins] CVS: nagiosplug/plugins check_pgsql.c,1.10,1.11 check_swap.c,1.12,1.13 check_tcp.c,1.28,1.29

Karl DeBisschop kdebisschop at users.sourceforge.net
Tue Jul 29 04:59:10 CEST 2003


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

Modified Files:
	check_pgsql.c check_swap.c check_tcp.c 
Log Message:
mark for translation

Index: check_pgsql.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_pgsql.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** check_pgsql.c	26 Jul 2003 12:15:06 -0000	1.10
--- check_pgsql.c	29 Jul 2003 11:58:16 -0000	1.11
***************
*** 24,34 ****
   *****************************************************************************/
  
- const char *progname = "check_pgsql";
- #define REVISION "$Revision$"
- #define COPYRIGHT "1999-2001"
- #define AUTHOR "Karl DeBisschop"
- #define EMAIL "kdebisschop at users.sourceforge.net"
- #define SUMMARY "Tests to see if a PostgreSQL DBMS is accepting connections.\n"
- 
  #define DEFAULT_DB "template1"
  #define DEFAULT_HOST "127.0.0.1"
--- 24,27 ----
***************
*** 66,69 ****
--- 59,67 ----
  PGconn *conn;
  /*PGresult   *res;*/
+ 
+ const char *progname = "check_pgsql";
+ const char *revision = "$Revision$";
+ const char *copyright = "1999-2003";
+ const char *email = "nagiosplug-devel at lists.sourceforge.net";
  
  
***************
*** 128,147 ****
  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\
!  -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 (default: %d)\n\
!  -4, --use-ipv4\n\
!     Use IPv4 connection\n\
!  -6, --use-ipv6\n\
!     Use IPv6 connection\n"), DEFAULT_PORT);
  	printf (S_("\
    -d, --database=STRING\n\
--- 126,141 ----
  print_help (void)
  {
! 	print_revision (progname, revision);
! 
! 	printf (_(COPYRIGHT), copyright, email);
! 
! 	printf (_("Test whether a PostgreSQL DBMS is accepting connections.\n\n"));
! 
  	print_usage ();
! 
! 	printf (_(HELP_VRSN));
! 
! 	printf (_(HOST_PORT_46), 'P', "5432");
! 
  	printf (S_("\
    -d, --database=STRING\n\
***************
*** 151,170 ****
    -p, --password = STRING\n\
      Password (BIG SECURITY ISSUE)\n\n"), DEFAULT_DB);
! 	printf (S_("\nOptions:\n\
!   -c, --critical=INTEGER\n\
!     Exit STATE_CRITICAL if connection time exceeds threshold (default: %d)\n\
!   -w, --warning=INTEGER\n\
!     Exit STATE_WARNING if connection time exceeds threshold (default: %d)\n\
!   -t, --timeout=INTEGER\n\
!     Terminate test if timeout limit is exceeded (default: %d)\n"),
! 	        DEFAULT_WARN, DEFAULT_CRIT, DEFAULT_TIMEOUT);
! 	printf (_("\
!  -v, --verbose\n\
!     Show details for command-line debugging (Nagios may truncate output)\n\
!  -h, --help\n\
!     Print detailed help screen\n\
!  -V, --version\n\
!     Print version information\n\n"));
! 	printf (S_("All parameters are optional.\n\
  \n\
  This plugin tests a PostgreSQL DBMS to determine whether it is active and\n\
--- 145,154 ----
    -p, --password = STRING\n\
      Password (BIG SECURITY ISSUE)\n\n"), DEFAULT_DB);
! 
! 	printf (_(WARN_CRIT_TO), DEFAULT_SOCKET_TIMEOUT);
! 
! 	printf (_(VRBS));
! 
! 	printf (S_("\nAll parameters are optional.\n\
  \n\
  This plugin tests a PostgreSQL DBMS to determine whether it is active and\n\
***************
*** 291,295 ****
  			exit (STATE_OK);
  		case 'V':     /* version */
! 			print_revision (progname, REVISION);
  			exit (STATE_OK);
  		case 't':     /* timeout period */
--- 275,279 ----
  			exit (STATE_OK);
  		case 'V':     /* version */
! 			print_revision (progname, revision);
  			exit (STATE_OK);
  		case 't':     /* timeout period */

Index: check_swap.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_swap.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** check_swap.c	29 Jun 2003 01:52:31 -0000	1.12
--- check_swap.c	29 Jul 2003 11:58:16 -0000	1.13
***************
*** 31,40 ****
  
  const char *progname = "check_swap";
! #define REVISION "$Revision$"
! #define COPYRIGHT "2000-2002"
! #define AUTHOR "Karl DeBisschop"
! #define EMAIL "kdebisschop at users.sourceforge.net"
! #define SUMMARY "Check swap space on local server.\n"
  
  int process_arguments (int argc, char **argv);
  int validate_arguments (void);
--- 31,39 ----
  
  const char *progname = "check_swap";
! const char *revision = "$Revision$";
! const char *copyright = "2000-2003";
! const char *email = "nagiosplug-devel at lists.sourceforge.net";
  
+ int check_swap (int usp, int free_swap);
  int process_arguments (int argc, char **argv);
  int validate_arguments (void);
***************
*** 53,56 ****
--- 52,107 ----
  #endif
  
+ void
+ print_usage (void)
+ {
+ 	printf (_("Usage:\n\
+  %s [-a] -w <used_percentage>%% -c <used_percentage>%%\n\
+  %s [-a] -w <bytes_free> -c <bytes_free>\n\
+  %s (-h | --help) for detailed help\n\
+  %s (-V | --version) for version information\n"),
+ 	        progname, progname, progname, progname);
+ }
+ 
+ 
+ 
+ 
+ 
+ void
+ print_help (void)
+ {
+ 	print_revision (progname, revision);
+ 
+ 	printf (_(COPYRIGHT), copyright, email);
+ 
+ 	printf (_("Check swap space on local server.\n\n"));
+ 
+ 	print_usage ();
+ 
+ 	printf (_(HELP_VRSN));
+ 
+ 	printf (_("\n\
+  -w, --warning=INTEGER\n\
+    Exit with WARNING status if less than INTEGER bytes of swap space are free\n\
+  -w, --warning=PERCENT%%\n\
+    Exit with WARNING status if less than PERCENT of swap space has been used\n\
+  -c, --critical=INTEGER\n\
+    Exit with CRITICAL status if less than INTEGER bytes of swap space are free\n\
+  -c, --critical=PERCENT%%\n\
+    Exit with CRITCAL status if less than PERCENT of swap space has been used\n\
+  -a, --allswaps\n\
+     Conduct comparisons for all swap partitions, one by one\n"));
+ 
+ #ifdef sun
+ 	printf (_("\n\
+ On Solaris, if -a specified, uses swap -l, otherwise uses swap -s.\n\
+ Will be discrepencies because swap -s counts allocated swap and includes\n\
+ real memory\n"));
+ #endif
+ 
+ 	support ();
+ }
+ 
+ 
+ 
  int
  main (int argc, char **argv)
***************
*** 58,66 ****
  	int percent_used, percent;
  	long unsigned int total_swap = 0, used_swap = 0, free_swap = 0;
! 	long unsigned int total, used, free;
! 	int conv_factor;		/* Convert to MBs */
  	int result = STATE_OK;
  	char input_buffer[MAX_INPUT_BUFFER];
  #ifdef HAVE_SWAP
  	char *temp_buffer;
  	char *swap_command;
--- 109,117 ----
  	int percent_used, percent;
  	long unsigned int total_swap = 0, used_swap = 0, free_swap = 0;
! 	long unsigned int dsktotal, dskused, dskfree;
  	int result = STATE_OK;
  	char input_buffer[MAX_INPUT_BUFFER];
  #ifdef HAVE_SWAP
+ 	int conv_factor;		/* Convert to MBs */
  	char *temp_buffer;
  	char *swap_command;
***************
*** 79,87 ****
  	fp = fopen (PROC_MEMINFO, "r");
  	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) {
! 		if (sscanf (input_buffer, " %s %lu %lu %lu", str, &total, &used, &free) == 4 &&
  		    strstr (str, "Swap")) {
! 			total = total / 1048576;
! 			used = used / 1048576;
! 			free = free / 1048576;
  #endif
  #ifdef HAVE_SWAP
--- 130,138 ----
  	fp = fopen (PROC_MEMINFO, "r");
  	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) {
! 		if (sscanf (input_buffer, " %s %lu %lu %lu", str, &dsktotal, &dskused, &dskfree) == 4 &&
  		    strstr (str, "Swap")) {
! 			dsktotal = dsktotal / 1048576;
! 			dskused = dskused / 1048576;
! 			dskfree = dskfree / 1048576;
  #endif
  #ifdef HAVE_SWAP
***************
*** 119,123 ****
  			if (strstr (temp_buffer, "blocks"))
  				sprintf (str, "%s %s", str, "%f");
! 			else if (strstr (temp_buffer, "free"))
  				sprintf (str, "%s %s", str, "%f");
  			else
--- 170,174 ----
  			if (strstr (temp_buffer, "blocks"))
  				sprintf (str, "%s %s", str, "%f");
! 			else if (strstr (temp_buffer, "dskfree"))
  				sprintf (str, "%s %s", str, "%f");
  			else
***************
*** 134,154 ****
  	} else {
  		while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
! 			sscanf (input_buffer, swap_format, &total, &free);
  
! 			total = total / conv_factor;
! 			free = free / conv_factor;
  			if (verbose >= 3)
! 				printf ("total=%d, free=%d\n", total, free);
  
! 			used = total - free;
  #endif
! 			total_swap += total;
! 			used_swap += used;
! 			free_swap += free;
  			if (allswaps) {
! 				percent = 100 * (((double) used) / ((double) total));
! 				result = max_state (result, check_swap (percent, free));
  				if (verbose)
! 					asprintf (&status, "%s [%lu (%d%%)]", status, free, 100 - percent);
  			}
  		}
--- 185,205 ----
  	} else {
  		while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
! 			sscanf (input_buffer, swap_format, &dsktotal, &dskfree);
  
! 			dsktotal = dsktotal / conv_factor;
! 			dskfree = dskfree / conv_factor;
  			if (verbose >= 3)
! 				printf ("total=%d, free=%d\n", dsktotal, dskfree);
  
! 			dskused = dsktotal - dskfree;
  #endif
! 			total_swap += dsktotal;
! 			used_swap += dskused;
! 			free_swap += dskfree;
  			if (allswaps) {
! 				percent = 100 * (((double) dskused) / ((double) dsktotal));
! 				result = max_state (result, check_swap (percent, dskfree));
  				if (verbose)
! 					asprintf (&status, "%s [%lu (%d%%)]", status, dskfree, 100 - percent);
  			}
  		}
***************
*** 176,179 ****
--- 227,231 ----
  
  	terminate (result, "SWAP %s:%s\n", state_text (result), status);
+ 	return STATE_UNKNOWN;
  }
  
***************
*** 187,195 ****
  	if (usp >= 0 && usp >= (100.0 - crit_percent))
  		result = STATE_CRITICAL;
! 	else if (crit_size >= 0 && free_swap <= crit_size)
  		result = STATE_CRITICAL;
  	else if (usp >= 0 && usp >= (100.0 - warn_percent))
  		result = STATE_WARNING;
! 	else if (warn_size >= 0 && free_swap <= warn_size)
  		result = STATE_WARNING;
  	else if (usp >= 0.0)
--- 239,247 ----
  	if (usp >= 0 && usp >= (100.0 - crit_percent))
  		result = STATE_CRITICAL;
! 	else if (crit_size > 0 && (unsigned)free_swap <= crit_size)
  		result = STATE_CRITICAL;
  	else if (usp >= 0 && usp >= (100.0 - warn_percent))
  		result = STATE_WARNING;
! 	else if (warn_size > 0 && (unsigned)free_swap <= warn_size)
  		result = STATE_WARNING;
  	else if (usp >= 0.0)
***************
*** 271,275 ****
  			break;
  		case 'V':									/* version */
! 			print_revision (progname, "$Revision$");
  			exit (STATE_OK);
  		case 'h':									/* help */
--- 323,327 ----
  			break;
  		case 'V':									/* version */
! 			print_revision (progname, revision);
  			exit (STATE_OK);
  		case 'h':									/* help */
***************
*** 294,303 ****
  	if (c == argc)
  		return validate_arguments ();
! 	if (warn_size < 0 && is_intnonneg (argv[c]))
  		warn_size = atoi (argv[c++]);
  
  	if (c == argc)
  		return validate_arguments ();
! 	if (crit_size < 0 && is_intnonneg (argv[c]))
  		crit_size = atoi (argv[c++]);
  
--- 346,355 ----
  	if (c == argc)
  		return validate_arguments ();
! 	if (warn_size == 0 && is_intnonneg (argv[c]))
  		warn_size = atoi (argv[c++]);
  
  	if (c == argc)
  		return validate_arguments ();
! 	if (crit_size == 0 && is_intnonneg (argv[c]))
  		crit_size = atoi (argv[c++]);
  
***************
*** 312,317 ****
  validate_arguments (void)
  {
! 	if (warn_percent > 100 && crit_percent > 100 && warn_size < 0
! 			&& crit_size < 0) {
  		return ERROR;
  	}
--- 364,369 ----
  validate_arguments (void)
  {
! 	if (warn_percent > 100 && crit_percent > 100 && warn_size == 0
! 			&& crit_size == 0) {
  		return ERROR;
  	}
***************
*** 325,378 ****
  	}
  	return OK;
- }
- 
- 
- 
- 
- 
- void
- print_usage (void)
- {
- 	printf
- 		("Usage:\n"
- 		 " %s [-a] -w <used_percentage>%% -c <used_percentage>%%\n"
- 		 " %s [-a] -w <bytes_free> -c <bytes_free>\n"
- 		 " %s (-h | --help) for detailed help\n"
- 		 " %s (-V | --version) for version information\n",
- 		 progname, progname, progname, progname);
- }
- 
- 
- 
- 
- 
- 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"
- 		 " -w, --warning=INTEGER\n"
- 		 "   Exit with WARNING status if less than INTEGER bytes of swap space are free\n"
- 		 " -w, --warning=PERCENT%%\n"
- 		 "   Exit with WARNING status if less than PERCENT of swap space has been used\n"
- 		 " -c, --critical=INTEGER\n"
- 		 "   Exit with CRITICAL status if less than INTEGER bytes of swap space are free\n"
- 		 " -c, --critical=PERCENT%%\n"
- 		 "   Exit with CRITCAL status if less than PERCENT of swap space has been used\n"
- 		 " -a, --allswaps\n"
- 		 "    Conduct comparisons for all swap partitions, one by one\n"
- 		 " -h, --help\n"
- 		 "    Print detailed help screen\n"
- 		 " -V, --version\n" "    Print version information\n"
- #ifdef sun
- 		 "\nOn Solaris, if -a specified, uses swap -l, otherwise uses swap -s.\n"
- 		 "Will be discrepencies because swap -s counts allocated swap and includes real memory\n"
- #endif
- 		 "\n"
- 		 );
- 	support ();
  }
--- 377,379 ----

Index: check_tcp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_tcp.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** check_tcp.c	26 Jul 2003 05:25:59 -0000	1.28
--- check_tcp.c	29 Jul 2003 11:58:16 -0000	1.29
***************
*** 100,109 ****
  Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\
  	[-s <send string>] [-e <expect string>] [-q <quit string>]\n\
! 	[-m <maximum bytes>] [-d <delay>]	[-t <timeout seconds>]\n\
  	[-r <refuse state>] [-v] [-4|-6]\n"), progname);
  	printf ("       %s (-h|--help)\n", progname);
  	printf ("       %s (-V|--version)\n", progname);
  }
- 
  void
  print_help (void)
--- 100,108 ----
  Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\
  	[-s <send string>] [-e <expect string>] [-q <quit string>]\n\
! 	[-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\
  	[-r <refuse state>] [-v] [-4|-6]\n"), progname);
  	printf ("       %s (-h|--help)\n", progname);
  	printf ("       %s (-V|--version)\n", progname);
  }
  void
  print_help (void)
***************
*** 111,136 ****
  	print_revision (progname, revision);
  
! 	printf (_("\
! Copyright (c) %s Nagios Plugin Development Team\n\
! \t<%s>\n\n"),
! 	        copyright, email);
  
! 	printf (_("\
! This plugin tests %s connections with the specified host.\n\n"),
  	        SERVICE);
  
  	print_usage ();
  
! 	printf (_("\
! \nOptions:\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\
!  -4, --use-ipv4\n\
!     Use IPv4 connection\n\
!  -6, --use-ipv6\n\
!     Use IPv6 connection\n"));
  
  	printf (_("\
--- 110,123 ----
  	print_revision (progname, revision);
  
! 	printf (_(COPYRIGHT), copyright, email);
  
! 	printf (_("This plugin tests %s connections with the specified host.\n\n"),
  	        SERVICE);
  
  	print_usage ();
  
! 	printf (_(HELP_VRSN));
! 
! 	printf (_(HOST_PORT_46), 'p', "none");
  
  	printf (_("\
***************
*** 148,167 ****
      Close connection once more than this number of bytes are received\n\
   -d, --delay=INTEGER\n\
!     Seconds to wait between sending string and polling for response\n\
!  -w, --warning=DOUBLE\n\
!     Response time to result in warning status (seconds)\n\
!  -c, --critical=DOUBLE\n\
!     Response time to result in critical status (seconds)\n"));
  
! 	printf (_("\
!  -t, --timeout=INTEGER\n\
!     Seconds before connection times out (default: %d)\n\
!  -v, --verbose\n\
!     Show details for command-line debugging (Nagios may truncate output)\n\
!  -h, --help\n\
!     Print detailed help screen\n\
!  -V, --version\n\
!     Print version information\n\n"),
! 					DEFAULT_SOCKET_TIMEOUT);
  
  	support ();
--- 135,143 ----
      Close connection once more than this number of bytes are received\n\
   -d, --delay=INTEGER\n\
!     Seconds to wait between sending string and polling for response\n"));
  
! 	printf (_(WARN_CRIT_TO), DEFAULT_SOCKET_TIMEOUT);
! 
! 	printf (_(VRBS));
  
  	support ();





More information about the Commits mailing list