[Nagiosplug-checkins] CVS: nagiosplug/plugins check_tcp.c,1.27,1.28
Karl DeBisschop
kdebisschop at users.sourceforge.net
Fri Jul 25 22:41:04 CEST 2003
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv24835/plugins
Modified Files:
check_tcp.c
Log Message:
internationalization
Index: check_tcp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_tcp.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** check_tcp.c 26 Jul 2003 04:06:33 -0000 1.27
--- check_tcp.c 26 Jul 2003 05:25:59 -0000 1.28
***************
*** 89,94 ****
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";
int
--- 89,172 ----
const char *revision = "$Revision$";
const char *copyright = "2002-2003";
const char *email = "nagiosplug-devel at lists.sourceforge.net";
+
+
+
+
+ void
+ print_usage (void)
+ {
+ printf (_("\
+ 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)
+ {
+ 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 (_("\
+ -s, --send=STRING\n\
+ String to send to the server\n\
+ -e, --expect=STRING\n\
+ String to expect in server response\n\
+ -q, --quit=STRING\n\
+ String to send server to initiate a clean close of the connection\n"));
+
+ printf (_("\
+ -r, --refuse=ok|warn|crit\n\
+ Accept tcp refusals with states ok, warn, crit (default: crit)\n\
+ -m, --maxbytes=INTEGER\n\
+ 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 ();
+ }
+
+
int
***************
*** 194,198 ****
}
else {
! usage ("ERROR: Generic check_tcp called with unknown service\n");
}
--- 272,276 ----
}
else {
! usage (_("ERROR: Generic check_tcp called with unknown service\n"));
}
***************
*** 203,207 ****
if (process_arguments (argc, argv) == ERROR)
! usage ("Could not parse arguments\n");
/* use default expect if none listed in process_arguments() */
--- 281,285 ----
if (process_arguments (argc, argv) == ERROR)
! usage (_("Could not parse arguments\n"));
/* use default expect if none listed in process_arguments() */
***************
*** 266,270 ****
/* return a CRITICAL status if we couldn't read any data */
if (status == NULL)
! terminate (STATE_CRITICAL, "No data received from host\n");
strip (status);
--- 344,348 ----
/* return a CRITICAL status if we couldn't read any data */
if (status == NULL)
! terminate (STATE_CRITICAL, _("No data received from host\n"));
strip (status);
***************
*** 278,282 ****
printf ("%d %d\n", i, server_expect_count);
if (i >= server_expect_count)
! terminate (STATE_WARNING, "Invalid response from host\n");
if (strstr (status, server_expect[i]))
break;
--- 356,360 ----
printf ("%d %d\n", i, server_expect_count);
if (i >= server_expect_count)
! terminate (STATE_WARNING, _("Invalid response from host\n"));
if (strstr (status, server_expect[i]))
break;
***************
*** 316,320 ****
printf
! ("%s %s%s - %.3f second response time on port %d",
SERVICE,
state_text (result),
--- 394,398 ----
printf
! (_("%s %s%s - %.3f second response time on port %d"),
SERVICE,
state_text (result),
***************
*** 392,396 ****
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);
--- 470,474 ----
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);
***************
*** 411,425 ****
address_family = AF_INET6;
#else
! usage ("IPv6 support not available\n");
#endif
break;
case 'H': /* hostname */
if (is_host (optarg) == FALSE)
! usage2 ("invalid host name or address", optarg);
server_address = optarg;
break;
case 'c': /* critical */
if (!is_intnonneg (optarg))
! usage ("Critical threshold must be a nonnegative integer\n");
critical_time = strtod (optarg, NULL);
check_critical_time = TRUE;
--- 489,503 ----
address_family = AF_INET6;
#else
! usage (_("IPv6 support not available\n"));
#endif
break;
case 'H': /* hostname */
if (is_host (optarg) == FALSE)
! usage2 (_("invalid host name or address"), optarg);
server_address = optarg;
break;
case 'c': /* critical */
if (!is_intnonneg (optarg))
! usage (_("Critical threshold must be a nonnegative integer\n"));
critical_time = strtod (optarg, NULL);
check_critical_time = TRUE;
***************
*** 427,431 ****
case 'w': /* warning */
if (!is_intnonneg (optarg))
! usage ("Warning threshold must be a nonnegative integer\n");
warning_time = strtod (optarg, NULL);
check_warning_time = TRUE;
--- 505,509 ----
case 'w': /* warning */
if (!is_intnonneg (optarg))
! usage (_("Warning threshold must be a nonnegative integer\n"));
warning_time = strtod (optarg, NULL);
check_warning_time = TRUE;
***************
*** 441,450 ****
case 't': /* timeout */
if (!is_intpos (optarg))
! usage ("Timeout interval must be a positive integer\n");
socket_timeout = atoi (optarg);
break;
case 'p': /* port */
if (!is_intpos (optarg))
! usage ("Server port must be a positive integer\n");
server_port = atoi (optarg);
break;
--- 519,528 ----
case 't': /* timeout */
if (!is_intpos (optarg))
! usage (_("Timeout interval must be a positive integer\n"));
socket_timeout = atoi (optarg);
break;
case 'p': /* port */
if (!is_intpos (optarg))
! usage (_("Server port must be a positive integer\n"));
server_port = atoi (optarg);
break;
***************
*** 462,466 ****
case 'm':
if (!is_intpos (optarg))
! usage ("Maxbytes must be a positive integer\n");
maxbytes = atoi (optarg);
case 'q':
--- 540,544 ----
case 'm':
if (!is_intpos (optarg))
! usage (_("Maxbytes must be a positive integer\n"));
maxbytes = atoi (optarg);
case 'q':
***************
*** 475,479 ****
econn_refuse_state = STATE_CRITICAL;
else
! usage ("Refuse mut be one of ok, warn, crit\n");
break;
case 'd':
--- 553,557 ----
econn_refuse_state = STATE_CRITICAL;
else
! usage (_("Refuse mut be one of ok, warn, crit\n"));
break;
case 'd':
***************
*** 481,490 ****
delay = atoi (optarg);
else
! usage ("Delay must be a positive integer\n");
break;
case 'S':
#ifndef HAVE_SSL
terminate (STATE_UNKNOWN,
! "SSL support not available. Install OpenSSL and recompile.");
#endif
use_ssl = TRUE;
--- 559,568 ----
delay = atoi (optarg);
else
! usage (_("Delay must be a positive integer\n"));
break;
case 'S':
#ifndef HAVE_SSL
terminate (STATE_UNKNOWN,
! _("SSL support not available. Install OpenSSL and recompile."));
#endif
use_ssl = TRUE;
***************
*** 494,498 ****
if (server_address == NULL)
! usage ("You must provide a server address\n");
return OK;
--- 572,576 ----
if (server_address == NULL)
! usage (_("You must provide a server address\n"));
return OK;
***************
*** 500,578 ****
-
-
- void
- print_help (void)
- {
- print_revision (progname, revision);
-
- printf ("Copyright (c) %s %s\n\t<%s>\n\n", copyright, authors, email);
-
- printf (_("\
- This plugin tests %s connections with the specified host.\n"), SERVICE);
-
- print_usage ();
-
- printf ("\nOptions:\n");
-
- printf (_("\
- -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 (_("\
- -s, --send=STRING\n\
- String to send to the server\n\
- -e, --expect=STRING\n\
- String to expect in server response\n\
- -q, --quit=STRING\n\
- String to send server to initiate a clean close of the connection\n"));
-
- printf (_("\
- -r, --refuse=ok|warn|crit\n\
- Accept tcp refusals with states ok, warn, crit (default: crit)\n\
- -m, --maxbytes=INTEGER\n\
- 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 ();
- }
-
- void
- print_usage (void)
- {
- printf ("Usage: %s %s\n", progname, _("\
- -H host -p port [-w warn_time] [-c crit_time] [-s send_string]\n\
- [-e expect_string] [-q quit_string] [-m maxbytes] [-d delay]\n\
- [-t to_sec] [-r refuse_state] [-v] [-4|-6]\n"));
- printf (" %s (-h|--help)\n", progname);
- printf (" %s (-V|--version)\n", progname);
- }
-
-
-
-
#ifdef HAVE_SSL
int
--- 578,581 ----
***************
*** 587,591 ****
if ((ctx = SSL_CTX_new (meth)) == NULL)
{
! printf ("ERROR: Cannot create SSL context.\n");
return STATE_CRITICAL;
}
--- 590,594 ----
if ((ctx = SSL_CTX_new (meth)) == NULL)
{
! printf (_("ERROR: Cannot create SSL context.\n"));
return STATE_CRITICAL;
}
***************
*** 613,617 ****
else
{
! printf ("ERROR: Cannot initiate SSL handshake.\n");
}
SSL_free (ssl);
--- 616,620 ----
else
{
! printf (_("ERROR: Cannot initiate SSL handshake.\n"));
}
SSL_free (ssl);
More information about the Commits
mailing list