diff options
Diffstat (limited to 'web/attachments/266199-check_ping-ignore-duplicates.patch')
-rw-r--r-- | web/attachments/266199-check_ping-ignore-duplicates.patch | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/web/attachments/266199-check_ping-ignore-duplicates.patch b/web/attachments/266199-check_ping-ignore-duplicates.patch new file mode 100644 index 0000000..01cf036 --- /dev/null +++ b/web/attachments/266199-check_ping-ignore-duplicates.patch | |||
@@ -0,0 +1,111 @@ | |||
1 | Index: Projects/Nagiosplug/trunk/plugins/check_ping.c | ||
2 | =================================================================== | ||
3 | --- Projects/Nagiosplug/trunk/plugins/check_ping.c (revision 1932) | ||
4 | +++ Projects/Nagiosplug/trunk/plugins/check_ping.c (working copy) | ||
5 | @@ -67,6 +67,7 @@ | ||
6 | int max_addr = 1; | ||
7 | int max_packets = -1; | ||
8 | int verbose = 0; | ||
9 | +int warn_on_duplicate = 1; | ||
10 | |||
11 | float rta = UNKNOWN_TRIP_TIME; | ||
12 | int pl = UNKNOWN_PACKET_LOSS; | ||
13 | @@ -192,6 +193,7 @@ | ||
14 | {"link", no_argument, 0, 'L'}, | ||
15 | {"use-ipv4", no_argument, 0, '4'}, | ||
16 | {"use-ipv6", no_argument, 0, '6'}, | ||
17 | + {"ignore-duplicates", no_argument, 0, "d"}, | ||
18 | {0, 0, 0, 0} | ||
19 | }; | ||
20 | |||
21 | @@ -206,7 +208,7 @@ | ||
22 | } | ||
23 | |||
24 | while (1) { | ||
25 | - c = getopt_long (argc, argv, "VvhnL46t:c:w:H:p:", longopts, &option); | ||
26 | + c = getopt_long (argc, argv, "VvhnL46t:c:d:w:H:p:", longopts, &option); | ||
27 | |||
28 | if (c == -1 || c == EOF) | ||
29 | break; | ||
30 | @@ -275,6 +277,9 @@ | ||
31 | case 'w': | ||
32 | get_threshold (optarg, &wrta, &wpl); | ||
33 | break; | ||
34 | + case 'd': | ||
35 | + warn_on_duplicate = 0; | ||
36 | + break; | ||
37 | } | ||
38 | } | ||
39 | |||
40 | @@ -527,12 +532,14 @@ | ||
41 | die (STATE_CRITICAL, _("CRITICAL - Time to live exceeded (%s)"), addr); | ||
42 | |||
43 | if (strstr (buf, "(DUP!)") || strstr (buf, "DUPLICATES FOUND")) { | ||
44 | - if (warn_text == NULL) | ||
45 | - warn_text = strdup (_(WARN_DUPLICATES)); | ||
46 | - else if (! strstr (warn_text, _(WARN_DUPLICATES)) && | ||
47 | - asprintf (&warn_text, "%s %s", warn_text, _(WARN_DUPLICATES)) == -1) | ||
48 | - die (STATE_UNKNOWN, _("Unable to realloc warn_text")); | ||
49 | - return (STATE_WARNING); | ||
50 | + if (warn_on_duplicate) { | ||
51 | + if (warn_text == NULL) | ||
52 | + warn_text = strdup (_(WARN_DUPLICATES)); | ||
53 | + else if (! strstr (warn_text, _(WARN_DUPLICATES)) && | ||
54 | + asprintf (&warn_text, "%s %s", warn_text, _(WARN_DUPLICATES)) == -1) | ||
55 | + die (STATE_UNKNOWN, _("Unable to realloc warn_text")); | ||
56 | + return (STATE_WARNING); | ||
57 | + } | ||
58 | } | ||
59 | |||
60 | return (STATE_OK); | ||
61 | @@ -559,31 +566,33 @@ | ||
62 | printf (_(UT_IPv46)); | ||
63 | |||
64 | printf (" %s\n", "-H, --hostname=HOST"); | ||
65 | - printf (" %s\n", _("host to ping")); | ||
66 | - printf (" %s\n", "-w, --warning=THRESHOLD"); | ||
67 | - printf (" %s\n", _("warning threshold pair")); | ||
68 | - printf (" %s\n", "-c, --critical=THRESHOLD"); | ||
69 | - printf (" %s\n", _("critical threshold pair")); | ||
70 | - printf (" %s\n", "-p, --packets=INTEGER"); | ||
71 | - printf (" %s ", _("number of ICMP ECHO packets to send")); | ||
72 | - printf (_("(Default: %d)\n"), DEFAULT_MAX_PACKETS); | ||
73 | - printf (" %s\n", "-L, --link"); | ||
74 | - printf (" %s\n", _("show HTML in the plugin output (obsoleted by urlize)")); | ||
75 | + printf (" %s\n", _("host to ping")); | ||
76 | + printf (" %s\n", "-w, --warning=THRESHOLD"); | ||
77 | + printf (" %s\n", _("warning threshold pair")); | ||
78 | + printf (" %s\n", "-c, --critical=THRESHOLD"); | ||
79 | + printf (" %s\n", _("critical threshold pair")); | ||
80 | + printf (" %s\n", "-p, --packets=INTEGER"); | ||
81 | + printf (" %s ", _("number of ICMP ECHO packets to send")); | ||
82 | + printf (_("(Default: %d)\n"), DEFAULT_MAX_PACKETS); | ||
83 | + printf (" %s\n", "-L, --link"); | ||
84 | + printf (" %s\n", _("show HTML in the plugin output (obsoleted by urlize)")); | ||
85 | + printf (" %s\n", "-d, --ignore-duplicates"); | ||
86 | + printf (" %s\n", _("don't warn on duplicate responses")); | ||
87 | |||
88 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
89 | |||
90 | printf ("%s\n", _("THRESHOLD is <rta>,<pl>% where <rta> is the round trip average travel")); | ||
91 | - printf ("%s\n", _("time (ms) which triggers a WARNING or CRITICAL state, and <pl> is the")); | ||
92 | - printf ("%s\n", _("percentage of packet loss to trigger an alarm state.")); | ||
93 | + printf ("%s\n", _("time (ms) which triggers a WARNING or CRITICAL state, and <pl> is the")); | ||
94 | + printf ("%s\n", _("percentage of packet loss to trigger an alarm state.")); | ||
95 | |||
96 | - printf ("\n\n"); | ||
97 | + printf ("\n\n"); | ||
98 | |||
99 | printf ("%s\n", _("This plugin uses the ping command to probe the specified host for packet loss")); | ||
100 | - printf ("%s\n", _("(percentage) and round trip average (milliseconds). It can produce HTML output")); | ||
101 | - printf ("%s\n", _("linking to a traceroute CGI contributed by Ian Cass. The CGI can be found in")); | ||
102 | - printf ("%s\n", _("the contrib area of the downloads section at http://www.nagios.org/")); | ||
103 | + printf ("%s\n", _("(percentage) and round trip average (milliseconds). It can produce HTML output")); | ||
104 | + printf ("%s\n", _("linking to a traceroute CGI contributed by Ian Cass. The CGI can be found in")); | ||
105 | + printf ("%s\n", _("the contrib area of the downloads section at http://www.nagios.org/")); | ||
106 | |||
107 | - printf ("\n\n"); | ||
108 | + printf ("\n\n"); | ||
109 | |||
110 | printf (_(UT_SUPPORT)); | ||
111 | } | ||