Index: Projects/Nagiosplug/trunk/plugins/check_ping.c =================================================================== --- Projects/Nagiosplug/trunk/plugins/check_ping.c (revision 1932) +++ Projects/Nagiosplug/trunk/plugins/check_ping.c (working copy) @@ -67,6 +67,7 @@ int max_addr = 1; int max_packets = -1; int verbose = 0; +int warn_on_duplicate = 1; float rta = UNKNOWN_TRIP_TIME; int pl = UNKNOWN_PACKET_LOSS; @@ -192,6 +193,7 @@ {"link", no_argument, 0, 'L'}, {"use-ipv4", no_argument, 0, '4'}, {"use-ipv6", no_argument, 0, '6'}, + {"ignore-duplicates", no_argument, 0, "d"}, {0, 0, 0, 0} }; @@ -206,7 +208,7 @@ } while (1) { - c = getopt_long (argc, argv, "VvhnL46t:c:w:H:p:", longopts, &option); + c = getopt_long (argc, argv, "VvhnL46t:c:d:w:H:p:", longopts, &option); if (c == -1 || c == EOF) break; @@ -275,6 +277,9 @@ case 'w': get_threshold (optarg, &wrta, &wpl); break; + case 'd': + warn_on_duplicate = 0; + break; } } @@ -527,12 +532,14 @@ die (STATE_CRITICAL, _("CRITICAL - Time to live exceeded (%s)"), addr); if (strstr (buf, "(DUP!)") || strstr (buf, "DUPLICATES FOUND")) { - if (warn_text == NULL) - warn_text = strdup (_(WARN_DUPLICATES)); - else if (! strstr (warn_text, _(WARN_DUPLICATES)) && - asprintf (&warn_text, "%s %s", warn_text, _(WARN_DUPLICATES)) == -1) - die (STATE_UNKNOWN, _("Unable to realloc warn_text")); - return (STATE_WARNING); + if (warn_on_duplicate) { + if (warn_text == NULL) + warn_text = strdup (_(WARN_DUPLICATES)); + else if (! strstr (warn_text, _(WARN_DUPLICATES)) && + asprintf (&warn_text, "%s %s", warn_text, _(WARN_DUPLICATES)) == -1) + die (STATE_UNKNOWN, _("Unable to realloc warn_text")); + return (STATE_WARNING); + } } return (STATE_OK); @@ -559,31 +566,33 @@ printf (_(UT_IPv46)); printf (" %s\n", "-H, --hostname=HOST"); - printf (" %s\n", _("host to ping")); - printf (" %s\n", "-w, --warning=THRESHOLD"); - printf (" %s\n", _("warning threshold pair")); - printf (" %s\n", "-c, --critical=THRESHOLD"); - printf (" %s\n", _("critical threshold pair")); - printf (" %s\n", "-p, --packets=INTEGER"); - printf (" %s ", _("number of ICMP ECHO packets to send")); - printf (_("(Default: %d)\n"), DEFAULT_MAX_PACKETS); - printf (" %s\n", "-L, --link"); - printf (" %s\n", _("show HTML in the plugin output (obsoleted by urlize)")); + printf (" %s\n", _("host to ping")); + printf (" %s\n", "-w, --warning=THRESHOLD"); + printf (" %s\n", _("warning threshold pair")); + printf (" %s\n", "-c, --critical=THRESHOLD"); + printf (" %s\n", _("critical threshold pair")); + printf (" %s\n", "-p, --packets=INTEGER"); + printf (" %s ", _("number of ICMP ECHO packets to send")); + printf (_("(Default: %d)\n"), DEFAULT_MAX_PACKETS); + printf (" %s\n", "-L, --link"); + printf (" %s\n", _("show HTML in the plugin output (obsoleted by urlize)")); + printf (" %s\n", "-d, --ignore-duplicates"); + printf (" %s\n", _("don't warn on duplicate responses")); printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); printf ("%s\n", _("THRESHOLD is ,% where is the round trip average travel")); - printf ("%s\n", _("time (ms) which triggers a WARNING or CRITICAL state, and is the")); - printf ("%s\n", _("percentage of packet loss to trigger an alarm state.")); + printf ("%s\n", _("time (ms) which triggers a WARNING or CRITICAL state, and is the")); + printf ("%s\n", _("percentage of packet loss to trigger an alarm state.")); - printf ("\n\n"); + printf ("\n\n"); printf ("%s\n", _("This plugin uses the ping command to probe the specified host for packet loss")); - printf ("%s\n", _("(percentage) and round trip average (milliseconds). It can produce HTML output")); - printf ("%s\n", _("linking to a traceroute CGI contributed by Ian Cass. The CGI can be found in")); - printf ("%s\n", _("the contrib area of the downloads section at http://www.nagios.org/")); + printf ("%s\n", _("(percentage) and round trip average (milliseconds). It can produce HTML output")); + printf ("%s\n", _("linking to a traceroute CGI contributed by Ian Cass. The CGI can be found in")); + printf ("%s\n", _("the contrib area of the downloads section at http://www.nagios.org/")); - printf ("\n\n"); + printf ("\n\n"); printf (_(UT_SUPPORT)); }