summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins-root/check_icmp.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index 6aeedf4..4c17d23 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -422,6 +422,44 @@ main(int argc, char **argv)
422 address_family = AF_INET; 422 address_family = AF_INET;
423 int icmp_proto = IPPROTO_ICMP; 423 int icmp_proto = IPPROTO_ICMP;
424 424
425 /* get calling name the old-fashioned way for portability instead
426 * of relying on the glibc-ism __progname */
427 ptr = strrchr(argv[0], '/');
428 if(ptr) progname = &ptr[1];
429 else progname = argv[0];
430
431 /* now set defaults. Use progname to set them initially (allows for
432 * superfast check_host program when target host is up */
433 cursor = list = NULL;
434 table = NULL;
435
436 mode = MODE_RTA;
437 crit.rta = 500000;
438 crit.pl = 80;
439 warn.rta = 200000;
440 warn.pl = 40;
441 protocols = HAVE_ICMP | HAVE_UDP | HAVE_TCP;
442 pkt_interval = 80000; /* 80 msec packet interval by default */
443 packets = 5;
444
445 if(!strcmp(progname, "check_icmp") || !strcmp(progname, "check_ping")) {
446 mode = MODE_ICMP;
447 protocols = HAVE_ICMP;
448 }
449 else if(!strcmp(progname, "check_host")) {
450 mode = MODE_HOSTCHECK;
451 pkt_interval = 1000000;
452 packets = 5;
453 crit.rta = warn.rta = 1000000;
454 crit.pl = warn.pl = 100;
455 }
456 else if(!strcmp(progname, "check_rta_multi")) {
457 mode = MODE_ALL;
458 target_interval = 0;
459 pkt_interval = 50000;
460 packets = 5;
461 }
462
425 /* parse the arguments */ 463 /* parse the arguments */
426 for(i = 1; i < argc; i++) { 464 for(i = 1; i < argc; i++) {
427 while((arg = getopt(argc, argv, "vhVw:c:n:p:t:H:s:i:b:I:l:m:64")) != EOF) { 465 while((arg = getopt(argc, argv, "vhVw:c:n:p:t:H:s:i:b:I:l:m:64")) != EOF) {
@@ -533,44 +571,6 @@ main(int argc, char **argv)
533 pid = getpid() & 0xffff; 571 pid = getpid() & 0xffff;
534 /* printf("pid = %u\n", pid); */ 572 /* printf("pid = %u\n", pid); */
535 573
536 /* get calling name the old-fashioned way for portability instead
537 * of relying on the glibc-ism __progname */
538 ptr = strrchr(argv[0], '/');
539 if(ptr) progname = &ptr[1];
540 else progname = argv[0];
541
542 /* now set defaults. Use progname to set them initially (allows for
543 * superfast check_host program when target host is up */
544 cursor = list = NULL;
545 table = NULL;
546
547 mode = MODE_RTA;
548 crit.rta = 500000;
549 crit.pl = 80;
550 warn.rta = 200000;
551 warn.pl = 40;
552 protocols = HAVE_ICMP | HAVE_UDP | HAVE_TCP;
553 pkt_interval = 80000; /* 80 msec packet interval by default */
554 packets = 5;
555
556 if(!strcmp(progname, "check_icmp") || !strcmp(progname, "check_ping")) {
557 mode = MODE_ICMP;
558 protocols = HAVE_ICMP;
559 }
560 else if(!strcmp(progname, "check_host")) {
561 mode = MODE_HOSTCHECK;
562 pkt_interval = 1000000;
563 packets = 5;
564 crit.rta = warn.rta = 1000000;
565 crit.pl = warn.pl = 100;
566 }
567 else if(!strcmp(progname, "check_rta_multi")) {
568 mode = MODE_ALL;
569 target_interval = 0;
570 pkt_interval = 50000;
571 packets = 5;
572 }
573
574 /* Parse extra opts if any */ 574 /* Parse extra opts if any */
575 argv=np_extra_opts(&argc, argv, progname); 575 argv=np_extra_opts(&argc, argv, progname);
576 576