summaryrefslogtreecommitdiffstats
path: root/plugins/check_ping.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_ping.c')
-rw-r--r--plugins/check_ping.c265
1 files changed, 125 insertions, 140 deletions
diff --git a/plugins/check_ping.c b/plugins/check_ping.c
index 06bf8e76..9eff13c3 100644
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.c
@@ -1,54 +1,26 @@
1/***************************************************************************** 1/******************************************************************************
2*
3* CHECK_PING.C
4*
5* Program: Ping plugin for Nagios
6* License: GPL
7* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
8*
9* $Id$
10*
11*****************************************************************************/
12 2
13const char *progname = "check_ping"; 3 This program is free software; you can redistribute it and/or modify
14#define REVISION "$Revision$" 4 it under the terms of the GNU General Public License as published by
15#define COPYRIGHT "1999-2001" 5 the Free Software Foundation; either version 2 of the License, or
16#define AUTHOR "Ethan Galstad/Karl DeBisschop" 6 (at your option) any later version.
17#define EMAIL "kdebisschop@users.sourceforge.net"
18#define SUMMARY "Use ping to check connection statistics for a remote host.\n"
19 7
20#define OPTIONS "\ 8 This program is distributed in the hope that it will be useful,
21-H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\ 9 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 [-p packets] [-t timeout] [-L] [-4|-6]\n" 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
23 12
24#define LONGOPTIONS "\ 13 You should have received a copy of the GNU General Public License
25-H, --hostname=HOST\n\ 14 along with this program; if not, write to the Free Software
26 host to ping\n\ 15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27-4, --use-ipv4\n\
28 Use IPv4 ICMP PING\n\
29-6, --use-ipv6\n\
30 Use IPv6 ICMP PING\n\
31-w, --warning=THRESHOLD\n\
32 warning threshold pair\n\
33-c, --critical=THRESHOLD\n\
34 critical threshold pair\n\
35-p, --packets=INTEGER\n\
36 number of ICMP ECHO packets to send (Default: %d)\n\
37-t, --timeout=INTEGER\n\
38 optional specified timeout in second (Default: %d)\n\
39-L, --link\n\
40 show HTML in the plugin output (obsoleted by urlize)\n\
41THRESHOLD is <rta>,<pl>%% where <rta> is the round trip average travel\n\
42time (ms) which triggers a WARNING or CRITICAL state, and <pl> is the\n\
43percentage of packet loss to trigger an alarm state.\n"
44 16
45#define DESCRIPTION "\ 17******************************************************************************/
46This plugin uses the ping command to probe the specified host for packet loss\n\ 18
47(percentage) and round trip average (milliseconds). It can produce HTML output\n\ 19const char *progname = "check_ping";
48linking to a traceroute CGI contributed by Ian Cass. The CGI can be found in\n\ 20const char *revision = "$Revision$";
49the contrib area of the downloads section at http://www.nagios.org\n\n" 21const char *copyright = "2000-2003";
22const char *email = "nagiosplug-devel@lists.sourceforge.net";
50 23
51#include "config.h"
52#include "common.h" 24#include "common.h"
53#include "netutils.h" 25#include "netutils.h"
54#include "popen.h" 26#include "popen.h"
@@ -94,12 +66,12 @@ main (int argc, char **argv)
94 addresses = malloc (max_addr); 66 addresses = malloc (max_addr);
95 67
96 if (process_arguments (argc, argv) == ERROR) 68 if (process_arguments (argc, argv) == ERROR)
97 usage ("Could not parse arguments"); 69 usage (_("Could not parse arguments"));
98 exit; 70 exit;
99 71
100 /* Set signal handling and alarm */ 72 /* Set signal handling and alarm */
101 if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { 73 if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) {
102 printf ("Cannot catch SIGALRM"); 74 printf (_("Cannot catch SIGALRM"));
103 return STATE_UNKNOWN; 75 return STATE_UNKNOWN;
104 } 76 }
105 77
@@ -138,7 +110,7 @@ main (int argc, char **argv)
138 if (pl == UNKNOWN_PACKET_LOSS || rta == UNKNOWN_TRIP_TIME) { 110 if (pl == UNKNOWN_PACKET_LOSS || rta == UNKNOWN_TRIP_TIME) {
139 printf ("%s\n", command_line); 111 printf ("%s\n", command_line);
140 terminate (STATE_UNKNOWN, 112 terminate (STATE_UNKNOWN,
141 "Error: Could not interpret output from ping command\n"); 113 _("Error: Could not interpret output from ping command\n"));
142 } 114 }
143 115
144 if (pl >= cpl || rta >= crta || rta < 0) 116 if (pl >= cpl || rta >= crta || rta < 0)
@@ -154,10 +126,10 @@ main (int argc, char **argv)
154 if (display_html == TRUE) 126 if (display_html == TRUE)
155 printf ("<A HREF='%s/traceroute.cgi?%s'>", CGIURL, addresses[i]); 127 printf ("<A HREF='%s/traceroute.cgi?%s'>", CGIURL, addresses[i]);
156 if (pl == 100) 128 if (pl == 100)
157 printf ("PING %s - %sPacket loss = %d%%", state_text (this_result), warn_text, 129 printf (_("PING %s - %sPacket loss = %d%%"), state_text (this_result), warn_text,
158 pl); 130 pl);
159 else 131 else
160 printf ("PING %s - %sPacket loss = %d%%, RTA = %2.2f ms", 132 printf (_("PING %s - %sPacket loss = %d%%, RTA = %2.2f ms"),
161 state_text (this_result), warn_text, pl, rta); 133 state_text (this_result), warn_text, pl, rta);
162 if (display_html == TRUE) 134 if (display_html == TRUE)
163 printf ("</A>"); 135 printf ("</A>");
@@ -210,12 +182,12 @@ process_arguments (int argc, char **argv)
210 182
211 switch (c) { 183 switch (c) {
212 case '?': /* usage */ 184 case '?': /* usage */
213 usage3 ("Unknown argument", optopt); 185 usage3 (_("Unknown argument"), optopt);
214 case 'h': /* help */ 186 case 'h': /* help */
215 print_help (); 187 print_help ();
216 exit (STATE_OK); 188 exit (STATE_OK);
217 case 'V': /* version */ 189 case 'V': /* version */
218 print_revision (progname, REVISION); 190 print_revision (progname, revision);
219 exit (STATE_OK); 191 exit (STATE_OK);
220 case 't': /* timeout period */ 192 case 't': /* timeout period */
221 timeout_interval = atoi (optarg); 193 timeout_interval = atoi (optarg);
@@ -230,7 +202,7 @@ process_arguments (int argc, char **argv)
230#ifdef USE_IPV6 202#ifdef USE_IPV6
231 address_family = AF_INET6; 203 address_family = AF_INET6;
232#else 204#else
233 usage ("IPv6 support not available\n"); 205 usage (_("IPv6 support not available\n"));
234#endif 206#endif
235 break; 207 break;
236 case 'H': /* hostname */ 208 case 'H': /* hostname */
@@ -241,10 +213,10 @@ process_arguments (int argc, char **argv)
241 max_addr *= 2; 213 max_addr *= 2;
242 addresses = realloc (addresses, max_addr); 214 addresses = realloc (addresses, max_addr);
243 if (addresses == NULL) 215 if (addresses == NULL)
244 terminate (STATE_UNKNOWN, "Could not realloc() addresses\n"); 216 terminate (STATE_UNKNOWN, _("Could not realloc() addresses\n"));
245 } 217 }
246 addresses[n_addresses-1] = ptr; 218 addresses[n_addresses-1] = ptr;
247 if (ptr = index (ptr, ',')) { 219 if ((ptr = index (ptr, ','))) {
248 strcpy (ptr, ""); 220 strcpy (ptr, "");
249 ptr += sizeof(char); 221 ptr += sizeof(char);
250 } else { 222 } else {
@@ -256,7 +228,7 @@ process_arguments (int argc, char **argv)
256 if (is_intnonneg (optarg)) 228 if (is_intnonneg (optarg))
257 max_packets = atoi (optarg); 229 max_packets = atoi (optarg);
258 else 230 else
259 usage2 ("<max_packets> (%s) must be a non-negative number\n", optarg); 231 usage2 (_("<max_packets> (%s) must be a non-negative number\n"), optarg);
260 break; 232 break;
261 case 'n': /* no HTML */ 233 case 'n': /* no HTML */
262 display_html = FALSE; 234 display_html = FALSE;
@@ -279,7 +251,7 @@ process_arguments (int argc, char **argv)
279 251
280 if (addresses[0] == NULL) { 252 if (addresses[0] == NULL) {
281 if (is_host (argv[c]) == FALSE) { 253 if (is_host (argv[c]) == FALSE) {
282 printf ("Invalid host name/address: %s\n\n", argv[c]); 254 printf (_("Invalid host name/address: %s\n\n"), argv[c]);
283 return ERROR; 255 return ERROR;
284 } else { 256 } else {
285 addresses[0] = argv[c++]; 257 addresses[0] = argv[c++];
@@ -290,7 +262,7 @@ process_arguments (int argc, char **argv)
290 262
291 if (wpl == UNKNOWN_PACKET_LOSS) { 263 if (wpl == UNKNOWN_PACKET_LOSS) {
292 if (is_intpercent (argv[c]) == FALSE) { 264 if (is_intpercent (argv[c]) == FALSE) {
293 printf ("<wpl> (%s) must be an integer percentage\n", argv[c]); 265 printf (_("<wpl> (%s) must be an integer percentage\n"), argv[c]);
294 return ERROR; 266 return ERROR;
295 } else { 267 } else {
296 wpl = atoi (argv[c++]); 268 wpl = atoi (argv[c++]);
@@ -301,7 +273,7 @@ process_arguments (int argc, char **argv)
301 273
302 if (cpl == UNKNOWN_PACKET_LOSS) { 274 if (cpl == UNKNOWN_PACKET_LOSS) {
303 if (is_intpercent (argv[c]) == FALSE) { 275 if (is_intpercent (argv[c]) == FALSE) {
304 printf ("<cpl> (%s) must be an integer percentage\n", argv[c]); 276 printf (_("<cpl> (%s) must be an integer percentage\n"), argv[c]);
305 return ERROR; 277 return ERROR;
306 } else { 278 } else {
307 cpl = atoi (argv[c++]); 279 cpl = atoi (argv[c++]);
@@ -312,7 +284,7 @@ process_arguments (int argc, char **argv)
312 284
313 if (wrta == UNKNOWN_TRIP_TIME) { 285 if (wrta == UNKNOWN_TRIP_TIME) {
314 if (is_negative (argv[c])) { 286 if (is_negative (argv[c])) {
315 printf ("<wrta> (%s) must be a non-negative number\n", argv[c]); 287 printf (_("<wrta> (%s) must be a non-negative number\n"), argv[c]);
316 return ERROR; 288 return ERROR;
317 } else { 289 } else {
318 wrta = atof (argv[c++]); 290 wrta = atof (argv[c++]);
@@ -323,7 +295,7 @@ process_arguments (int argc, char **argv)
323 295
324 if (crta == UNKNOWN_TRIP_TIME) { 296 if (crta == UNKNOWN_TRIP_TIME) {
325 if (is_negative (argv[c])) { 297 if (is_negative (argv[c])) {
326 printf ("<crta> (%s) must be a non-negative number\n", argv[c]); 298 printf (_("<crta> (%s) must be a non-negative number\n"), argv[c]);
327 return ERROR; 299 return ERROR;
328 } else { 300 } else {
329 crta = atof (argv[c++]); 301 crta = atof (argv[c++]);
@@ -336,7 +308,7 @@ process_arguments (int argc, char **argv)
336 if (is_intnonneg (argv[c])) { 308 if (is_intnonneg (argv[c])) {
337 max_packets = atoi (argv[c++]); 309 max_packets = atoi (argv[c++]);
338 } else { 310 } else {
339 printf ("<max_packets> (%s) must be a non-negative number\n", argv[c]); 311 printf (_("<max_packets> (%s) must be a non-negative number\n"), argv[c]);
340 return ERROR; 312 return ERROR;
341 } 313 }
342 } 314 }
@@ -353,8 +325,9 @@ get_threshold (char *arg, float *trta, int *tpl)
353 return OK; 325 return OK;
354 else if (strstr (arg, "%") && sscanf (arg, "%d%%", tpl) == 1) 326 else if (strstr (arg, "%") && sscanf (arg, "%d%%", tpl) == 1)
355 return OK; 327 return OK;
356 else 328
357 usage2 ("%s: Warning threshold must be integer or percentage!\n\n", arg); 329 usage2 (_("%s: Warning threshold must be integer or percentage!\n\n"), arg);
330 return STATE_UNKNOWN;
358} 331}
359 332
360int 333int
@@ -364,27 +337,27 @@ validate_arguments ()
364 int i; 337 int i;
365 338
366 if (wrta == UNKNOWN_TRIP_TIME) { 339 if (wrta == UNKNOWN_TRIP_TIME) {
367 printf ("<wrta> was not set\n"); 340 printf (_("<wrta> was not set\n"));
368 return ERROR; 341 return ERROR;
369 } 342 }
370 else if (crta == UNKNOWN_TRIP_TIME) { 343 else if (crta == UNKNOWN_TRIP_TIME) {
371 printf ("<crta> was not set\n"); 344 printf (_("<crta> was not set\n"));
372 return ERROR; 345 return ERROR;
373 } 346 }
374 else if (wpl == UNKNOWN_PACKET_LOSS) { 347 else if (wpl == UNKNOWN_PACKET_LOSS) {
375 printf ("<wpl> was not set\n"); 348 printf (_("<wpl> was not set\n"));
376 return ERROR; 349 return ERROR;
377 } 350 }
378 else if (cpl == UNKNOWN_PACKET_LOSS) { 351 else if (cpl == UNKNOWN_PACKET_LOSS) {
379 printf ("<cpl> was not set\n"); 352 printf (_("<cpl> was not set\n"));
380 return ERROR; 353 return ERROR;
381 } 354 }
382 else if (wrta > crta) { 355 else if (wrta > crta) {
383 printf ("<wrta> (%f) cannot be larger than <crta> (%f)\n", wrta, crta); 356 printf (_("<wrta> (%f) cannot be larger than <crta> (%f)\n"), wrta, crta);
384 return ERROR; 357 return ERROR;
385 } 358 }
386 else if (wpl > cpl) { 359 else if (wpl > cpl) {
387 printf ("<wpl> (%d) cannot be larger than <cpl> (%d)\n", wpl, cpl); 360 printf (_("<wpl> (%d) cannot be larger than <cpl> (%d)\n"), wpl, cpl);
388 return ERROR; 361 return ERROR;
389 } 362 }
390 363
@@ -397,7 +370,7 @@ validate_arguments ()
397 370
398 for (i=0; i<n_addresses; i++) { 371 for (i=0; i<n_addresses; i++) {
399 if (is_host(addresses[i]) == FALSE) 372 if (is_host(addresses[i]) == FALSE)
400 usage2 ("Invalid host name/address", addresses[i]); 373 usage2 (_("Invalid host name/address"), addresses[i]);
401 } 374 }
402 375
403 return OK; 376 return OK;
@@ -407,25 +380,25 @@ validate_arguments ()
407int 380int
408run_ping (char *command_line, char *server_address) 381run_ping (char *command_line, char *server_address)
409{ 382{
410 char input_buffer[MAX_INPUT_BUFFER]; 383 char buf[MAX_INPUT_BUFFER];
411 int result = STATE_UNKNOWN; 384 int result = STATE_UNKNOWN;
412 385
413 warn_text = malloc (1); 386 warn_text = malloc (1);
414 if (warn_text == NULL) 387 if (warn_text == NULL)
415 terminate (STATE_UNKNOWN, "unable to malloc warn_text"); 388 terminate (STATE_UNKNOWN, _("unable to malloc warn_text"));
416 warn_text[0] = 0; 389 warn_text[0] = 0;
417 390
418 if ((child_process = spopen (command_line)) == NULL) { 391 if ((child_process = spopen (command_line)) == NULL) {
419 printf ("Cannot open pipe: "); 392 printf (_("Cannot open pipe: "));
420 terminate (STATE_UNKNOWN, command_line); 393 terminate (STATE_UNKNOWN, command_line);
421 } 394 }
422 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); 395 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
423 if (child_stderr == NULL) 396 if (child_stderr == NULL)
424 printf ("Cannot open stderr for %s\n", command_line); 397 printf (_("Cannot open stderr for %s\n"), command_line);
425 398
426 while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { 399 while (fgets (buf, MAX_INPUT_BUFFER - 1, child_process)) {
427 400
428 if (strstr (input_buffer, "(DUP!)")) { 401 if (strstr (buf, _("(DUP!)"))) {
429 /* cannot use the max function since STATE_UNKNOWN is max 402 /* cannot use the max function since STATE_UNKNOWN is max
430 result = max (result, STATE_WARNING); */ 403 result = max (result, STATE_WARNING); */
431 if( !(result == STATE_CRITICAL) ){ 404 if( !(result == STATE_CRITICAL) ){
@@ -434,46 +407,26 @@ run_ping (char *command_line, char *server_address)
434 407
435 warn_text = realloc (warn_text, strlen (WARN_DUPLICATES) + 1); 408 warn_text = realloc (warn_text, strlen (WARN_DUPLICATES) + 1);
436 if (warn_text == NULL) 409 if (warn_text == NULL)
437 terminate (STATE_UNKNOWN, "unable to realloc warn_text"); 410 terminate (STATE_UNKNOWN, _("unable to realloc warn_text"));
438 strcpy (warn_text, WARN_DUPLICATES); 411 strcpy (warn_text, WARN_DUPLICATES);
439 } 412 }
440 413
441 /* get the percent loss statistics */ 414 /* get the percent loss statistics */
442 if (sscanf 415 if(sscanf(buf,"%*d packets transmitted, %*d packets received, +%*d errors, %d%% packet loss",&pl)==1 ||
443 (input_buffer, "%*d packets transmitted, %*d packets received, +%*d errors, %d%% packet loss", 416 sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% packet loss",&pl)==1 ||
444 &pl) == 1 417 sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% loss, time",&pl)==1 ||
445 || sscanf 418 sscanf(buf,"%*d packets transmitted, %*d received, %d%% loss, time", &pl)==1)
446 (input_buffer, "%*d packets transmitted, %*d packets received, %d%% packet loss",
447 &pl) == 1
448 || sscanf
449 (input_buffer, "%*d packets transmitted, %*d packets received, %d%% loss, time", &pl) == 1
450 || sscanf
451 (input_buffer, "%*d packets transmitted, %*d received, %d%% loss, time", &pl) == 1
452 /* Suse 8.0 as reported by Richard * Brodie */
453 )
454 continue; 419 continue;
455 420
456 /* get the round trip average */ 421 /* get the round trip average */
457 else 422 else
458 if (sscanf (input_buffer, "round-trip min/avg/max = %*f/%f/%*f", &rta) 423 if(sscanf(buf,"round-trip min/avg/max = %*f/%f/%*f",&rta)==1 ||
459 == 1 424 sscanf(buf,"round-trip min/avg/max/mdev = %*f/%f/%*f/%*f",&rta)==1 ||
460 || sscanf (input_buffer, 425 sscanf(buf,"round-trip min/avg/max/sdev = %*f/%f/%*f/%*f",&rta)==1 ||
461 "round-trip min/avg/max/mdev = %*f/%f/%*f/%*f", 426 sscanf(buf,"round-trip min/avg/max/stddev = %*f/%f/%*f/%*f",&rta)==1 ||
462 &rta) == 1 427 sscanf(buf,"round-trip min/avg/max/std-dev = %*f/%f/%*f/%*f",&rta)==1 ||
463 || sscanf (input_buffer, 428 sscanf(buf,"round-trip (ms) min/avg/max = %*f/%f/%*f",&rta)==1 ||
464 "round-trip min/avg/max/sdev = %*f/%f/%*f/%*f", 429 sscanf(buf,"rtt min/avg/max/mdev = %*f/%f/%*f/%*f ms",&rta)==1)
465 &rta) == 1
466 || sscanf (input_buffer,
467 "round-trip min/avg/max/stddev = %*f/%f/%*f/%*f",
468 &rta) == 1
469 || sscanf (input_buffer,
470 "round-trip min/avg/max/std-dev = %*f/%f/%*f/%*f",
471 &rta) == 1
472 || sscanf (input_buffer, "round-trip (ms) min/avg/max = %*f/%f/%*f",
473 &rta) == 1
474 || sscanf (input_buffer, "rtt min/avg/max/mdev = %*f/%f/%*f/%*f ms",
475 &rta) == 1
476 )
477 continue; 430 continue;
478 } 431 }
479 432
@@ -483,32 +436,33 @@ run_ping (char *command_line, char *server_address)
483 436
484 437
485 /* check stderr */ 438 /* check stderr */
486 while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { 439 while (fgets (buf, MAX_INPUT_BUFFER - 1, child_stderr)) {
487 if (strstr 440 if (strstr(buf,"Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMP"))
488 (input_buffer,
489 "Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMP"))
490 continue; 441 continue;
491 442
492 if (strstr (input_buffer, "Network is unreachable")) 443 if (strstr (buf, "Network is unreachable"))
493 terminate (STATE_CRITICAL, "PING CRITICAL - Network unreachable (%s)", 444 terminate (STATE_CRITICAL,
494 server_address); 445 _("PING CRITICAL - Network unreachable (%s)"),
495 else if (strstr (input_buffer, "Destination Host Unreachable")) 446 server_address);
496 terminate (STATE_CRITICAL, "PING CRITICAL - Host Unreachable (%s)", 447 else if (strstr (buf, "Destination Host Unreachable"))
497 server_address); 448 terminate (STATE_CRITICAL,
498 else if (strstr (input_buffer, "unknown host" ) ) 449 _("PING CRITICAL - Host Unreachable (%s)"),
499 terminate (STATE_CRITICAL, "PING CRITICAL - Host not found (%s)", 450 server_address);
500 server_address); 451 else if (strstr (buf, "unknown host" ))
452 terminate (STATE_CRITICAL,
453 _("PING CRITICAL - Host not found (%s)"),
454 server_address);
501 455
502 warn_text = 456 warn_text =
503 realloc (warn_text, strlen (warn_text) + strlen (input_buffer) + 2); 457 realloc (warn_text, strlen (warn_text) + strlen (buf) + 2);
504 if (warn_text == NULL) 458 if (warn_text == NULL)
505 terminate (STATE_UNKNOWN, "unable to realloc warn_text"); 459 terminate (STATE_UNKNOWN, _("unable to realloc warn_text"));
506 if (strlen (warn_text) == 0) 460 if (strlen (warn_text) == 0)
507 strcpy (warn_text, input_buffer); 461 strcpy (warn_text, buf);
508 else 462 else
509 sprintf (warn_text, "%s %s", warn_text, input_buffer); 463 sprintf (warn_text, "%s %s", warn_text, buf);
510 464
511 if (strstr (input_buffer, "DUPLICATES FOUND")) { 465 if (strstr (buf, "DUPLICATES FOUND")) {
512 if( !(result == STATE_CRITICAL) ){ 466 if( !(result == STATE_CRITICAL) ){
513 result = STATE_WARNING; 467 result = STATE_WARNING;
514 } 468 }
@@ -530,22 +484,53 @@ run_ping (char *command_line, char *server_address)
530void 484void
531print_usage (void) 485print_usage (void)
532{ 486{
533 printf ("Usage:\n" " %s %s\n" 487 printf (\
534 " %s (-h | --help) for detailed help\n" 488"Usage: %s -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\
535 " %s (-V | --version) for version information\n", 489 [-p packets] [-t timeout] [-L] [-4|-6]\n", progname);
536 progname, OPTIONS, progname, progname); 490 printf (_(UT_HLP_VRS), progname, progname);
537} 491}
538 492
539void 493void
540print_help (void) 494print_help (void)
541{ 495{
542 print_revision (progname, REVISION); 496 print_revision (progname, revision);
543 printf 497
544 ("Copyright (c) %s %s <%s>\n\n%s\n", 498 printf (_("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>"));
545 COPYRIGHT, AUTHOR, EMAIL, SUMMARY); 499 printf (_(COPYRIGHT), copyright, email);
500
501 printf (_("Use ping to check connection statistics for a remote host.\n\n"));
502
546 print_usage (); 503 print_usage ();
547 printf 504
548 ("\nOptions:\n" LONGOPTIONS "\n" DESCRIPTION "\n", 505 printf (_(UT_HELP_VRSN));
549 DEFAULT_MAX_PACKETS, DEFAULT_SOCKET_TIMEOUT); 506
550 support (); 507 printf (_(UT_IPv46));
508
509 printf (_("\
510-H, --hostname=HOST\n\
511 host to ping\n\
512-w, --warning=THRESHOLD\n\
513 warning threshold pair\n\
514-c, --critical=THRESHOLD\n\
515 critical threshold pair\n\
516-p, --packets=INTEGER\n\
517 number of ICMP ECHO packets to send (Default: %d)\n\
518-L, --link\n\
519 show HTML in the plugin output (obsoleted by urlize)\n"),
520 DEFAULT_MAX_PACKETS);
521
522 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
523
524 printf (_("\
525THRESHOLD is <rta>,<pl>%% where <rta> is the round trip average travel\n\
526time (ms) which triggers a WARNING or CRITICAL state, and <pl> is the\n\
527percentage of packet loss to trigger an alarm state.\n\n"));
528
529 printf (_("\
530This plugin uses the ping command to probe the specified host for packet loss\n\
531(percentage) and round trip average (milliseconds). It can produce HTML output\n\
532linking to a traceroute CGI contributed by Ian Cass. The CGI can be found in\n\
533the contrib area of the downloads section at http://www.nagios.org\n\n"));
534
535 printf (_(UT_SUPPORT));
551} 536}