diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-07-26 04:17:17 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-07-26 04:17:17 +0000 |
commit | 33a6787f51503d1b24f42e57cf365a48378dd56e (patch) | |
tree | ed1f566f37269e6928ad733301b9529022f9c4cd /plugins/check_tcp.c | |
parent | 35d8e3500946289de2638596bc0f93b044acc42c (diff) | |
download | monitoring-plugins-33a6787f51503d1b24f42e57cf365a48378dd56e.tar.gz |
checkins for internationalization
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@598 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_tcp.c')
-rw-r--r-- | plugins/check_tcp.c | 123 |
1 files changed, 65 insertions, 58 deletions
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index ce4fd31f..afb1a681 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c | |||
@@ -15,59 +15,6 @@ | |||
15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
16 | * | 16 | * |
17 | *****************************************************************************/ | 17 | *****************************************************************************/ |
18 | |||
19 | /* progname changes depending on symlink called */ | ||
20 | char *progname = "check_tcp"; | ||
21 | const char *revision = "$Revision$"; | ||
22 | const char *copyright = "2002-2003"; | ||
23 | const char *authors = "Nagios Plugin Development Team"; | ||
24 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
25 | |||
26 | const char *summary = "\ | ||
27 | This plugin tests %s connections with the specified host.\n"; | ||
28 | |||
29 | const char *option_summary = "\ | ||
30 | -H host -p port [-w warn_time] [-c crit_time] [-s send_string]\n\ | ||
31 | [-e expect_string] [-q quit_string] [-m maxbytes] [-d delay]\n\ | ||
32 | [-t to_sec] [-r refuse_state] [-v] [-4|-6]\n"; | ||
33 | |||
34 | const char *options = "\ | ||
35 | -H, --hostname=ADDRESS\n\ | ||
36 | Host name argument for servers using host headers (use numeric\n\ | ||
37 | address if possible to bypass DNS lookup).\n\ | ||
38 | -p, --port=INTEGER\n\ | ||
39 | Port number\n\ | ||
40 | -4, --use-ipv4\n\ | ||
41 | Use IPv4 connection\n\ | ||
42 | -6, --use-ipv6\n\ | ||
43 | Use IPv6 connection\n\ | ||
44 | -s, --send=STRING\n\ | ||
45 | String to send to the server\n\ | ||
46 | -e, --expect=STRING\n\ | ||
47 | String to expect in server response\n\ | ||
48 | -q, --quit=STRING\n\ | ||
49 | String to send server to initiate a clean close of the connection\n\ | ||
50 | -m, --maxbytes=INTEGER\n\ | ||
51 | Close connection once more than this number of bytes are received\n\ | ||
52 | -d, --delay=INTEGER\n\ | ||
53 | Seconds to wait between sending string and polling for response\n\ | ||
54 | -w, --warning=DOUBLE\n\ | ||
55 | Response time to result in warning status (seconds)\n\ | ||
56 | -c, --critical=DOUBLE\n\ | ||
57 | Response time to result in critical status (seconds)\n\ | ||
58 | -t, --timeout=INTEGER\n\ | ||
59 | Seconds before connection times out (default: %d)\n\ | ||
60 | -r, --refuse=ok|warn|crit\n\ | ||
61 | Accept tcp refusals with states ok, warn, crit (default: crit)\n\ | ||
62 | -v, --verbose\n\ | ||
63 | Show details for command-line debugging (Nagios may truncate output)\n"; | ||
64 | |||
65 | const char *standard_options = "\ | ||
66 | -h, --help\n\ | ||
67 | Print detailed help screen\n\ | ||
68 | -V, --version\n\ | ||
69 | Print version information\n\n"; | ||
70 | |||
71 | #include "config.h" | 18 | #include "config.h" |
72 | #include "common.h" | 19 | #include "common.h" |
73 | #include "netutils.h" | 20 | #include "netutils.h" |
@@ -137,6 +84,13 @@ int use_ssl = FALSE; | |||
137 | int sd = 0; | 84 | int sd = 0; |
138 | char *buffer = ""; | 85 | char *buffer = ""; |
139 | 86 | ||
87 | /* progname changes depending on symlink called */ | ||
88 | char *progname = "check_tcp"; | ||
89 | const char *revision = "$Revision$"; | ||
90 | const char *copyright = "2002-2003"; | ||
91 | const char *authors = "Nagios Plugin Development Team"; | ||
92 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
93 | |||
140 | int | 94 | int |
141 | main (int argc, char **argv) | 95 | main (int argc, char **argv) |
142 | { | 96 | { |
@@ -145,6 +99,10 @@ main (int argc, char **argv) | |||
145 | char *status = ""; | 99 | char *status = ""; |
146 | struct timeval tv; | 100 | struct timeval tv; |
147 | 101 | ||
102 | setlocale (LC_ALL, ""); | ||
103 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
104 | textdomain (PACKAGE); | ||
105 | |||
148 | if (strstr (argv[0], "check_udp")) { | 106 | if (strstr (argv[0], "check_udp")) { |
149 | progname = strdup ("check_udp"); | 107 | progname = strdup ("check_udp"); |
150 | SERVICE = strdup ("UDP"); | 108 | SERVICE = strdup ("UDP"); |
@@ -301,7 +259,7 @@ main (int argc, char **argv) | |||
301 | asprintf (&status, "%s%s", status, buffer); | 259 | asprintf (&status, "%s%s", status, buffer); |
302 | if (buffer[i-2] == '\r' && buffer[i-1] == '\n') | 260 | if (buffer[i-2] == '\r' && buffer[i-1] == '\n') |
303 | break; | 261 | break; |
304 | if (maxbytes>0 && strlen(status)>=maxbytes) | 262 | if (maxbytes>0 && strlen(status) >= (unsigned)maxbytes) |
305 | break; | 263 | break; |
306 | } | 264 | } |
307 | 265 | ||
@@ -547,19 +505,68 @@ void | |||
547 | print_help (void) | 505 | print_help (void) |
548 | { | 506 | { |
549 | print_revision (progname, revision); | 507 | print_revision (progname, revision); |
508 | |||
550 | printf ("Copyright (c) %s %s\n\t<%s>\n\n", copyright, authors, email); | 509 | printf ("Copyright (c) %s %s\n\t<%s>\n\n", copyright, authors, email); |
551 | printf (summary, SERVICE); | 510 | |
511 | printf (_("\ | ||
512 | This plugin tests %s connections with the specified host.\n"), SERVICE); | ||
513 | |||
552 | print_usage (); | 514 | print_usage (); |
515 | |||
553 | printf ("\nOptions:\n"); | 516 | printf ("\nOptions:\n"); |
554 | printf (options, DEFAULT_SOCKET_TIMEOUT); | 517 | |
555 | printf (standard_options); | 518 | printf (_("\ |
519 | -H, --hostname=ADDRESS\n\ | ||
520 | Host name argument for servers using host headers (use numeric\n\ | ||
521 | address if possible to bypass DNS lookup).\n\ | ||
522 | -p, --port=INTEGER\n\ | ||
523 | Port number\n\ | ||
524 | -4, --use-ipv4\n\ | ||
525 | Use IPv4 connection\n\ | ||
526 | -6, --use-ipv6\n\ | ||
527 | Use IPv6 connection\n")); | ||
528 | |||
529 | printf (_("\ | ||
530 | -s, --send=STRING\n\ | ||
531 | String to send to the server\n\ | ||
532 | -e, --expect=STRING\n\ | ||
533 | String to expect in server response\n\ | ||
534 | -q, --quit=STRING\n\ | ||
535 | String to send server to initiate a clean close of the connection\n")); | ||
536 | |||
537 | printf (_("\ | ||
538 | -r, --refuse=ok|warn|crit\n\ | ||
539 | Accept tcp refusals with states ok, warn, crit (default: crit)\n\ | ||
540 | -m, --maxbytes=INTEGER\n\ | ||
541 | Close connection once more than this number of bytes are received\n\ | ||
542 | -d, --delay=INTEGER\n\ | ||
543 | Seconds to wait between sending string and polling for response\n\ | ||
544 | -w, --warning=DOUBLE\n\ | ||
545 | Response time to result in warning status (seconds)\n\ | ||
546 | -c, --critical=DOUBLE\n\ | ||
547 | Response time to result in critical status (seconds)\n")); | ||
548 | |||
549 | printf (_("\ | ||
550 | -t, --timeout=INTEGER\n\ | ||
551 | Seconds before connection times out (default: %d)\n\ | ||
552 | -v, --verbose\n\ | ||
553 | Show details for command-line debugging (Nagios may truncate output)\n\ | ||
554 | -h, --help\n\ | ||
555 | Print detailed help screen\n\ | ||
556 | -V, --version\n\ | ||
557 | Print version information\n\n"), | ||
558 | DEFAULT_SOCKET_TIMEOUT); | ||
559 | |||
556 | support (); | 560 | support (); |
557 | } | 561 | } |
558 | 562 | ||
559 | void | 563 | void |
560 | print_usage (void) | 564 | print_usage (void) |
561 | { | 565 | { |
562 | printf ("Usage: %s %s\n", progname, option_summary); | 566 | printf ("Usage: %s %s\n", progname, _("\ |
567 | -H host -p port [-w warn_time] [-c crit_time] [-s send_string]\n\ | ||
568 | [-e expect_string] [-q quit_string] [-m maxbytes] [-d delay]\n\ | ||
569 | [-t to_sec] [-r refuse_state] [-v] [-4|-6]\n")); | ||
563 | printf (" %s (-h|--help)\n", progname); | 570 | printf (" %s (-h|--help)\n", progname); |
564 | printf (" %s (-V|--version)\n", progname); | 571 | printf (" %s (-V|--version)\n", progname); |
565 | } | 572 | } |