New upstream version 2.3.2

This commit is contained in:
Jan Wagner 2022-10-19 17:24:24 +02:00
parent 09f4277f49
commit 21323d25dd
104 changed files with 34386 additions and 7430 deletions

View file

@ -37,6 +37,8 @@ const char *email = "devel@monitoring-plugins.org";
#include "popen.h"
#include "utils.h"
#include <signal.h>
#define WARN_DUPLICATES "DUPLICATES FOUND! "
#define UNKNOWN_TRIP_TIME -1.0 /* -1 seconds */
@ -138,7 +140,7 @@ main (int argc, char **argv)
if (pl == UNKNOWN_PACKET_LOSS || rta < 0.0) {
printf ("%s\n", cmd);
die (STATE_UNKNOWN,
_("CRITICAL - Could not interpret output from ping command\n"));
_("CRITICAL - Could not interpret output from ping command\n"));
}
if (pl >= cpl || rta >= crta || rta < 0)
@ -163,10 +165,14 @@ main (int argc, char **argv)
printf ("</A>");
/* Print performance data */
printf("|%s", fperfdata ("rta", (double) rta, "ms",
wrta>0?TRUE:FALSE, wrta,
crta>0?TRUE:FALSE, crta,
TRUE, 0, FALSE, 0));
if (pl != 100) {
printf("|%s", fperfdata ("rta", (double) rta, "ms",
wrta>0?TRUE:FALSE, wrta,
crta>0?TRUE:FALSE, crta,
TRUE, 0, FALSE, 0));
} else {
printf("| rta=U;%f;%f;;", wrta, crta);
}
printf(" %s\n", perfdata ("pl", (long) pl, "%",
wpl>0?TRUE:FALSE, wpl,
cpl>0?TRUE:FALSE, cpl,
@ -521,12 +527,13 @@ int
error_scan (char buf[MAX_INPUT_BUFFER], const char *addr)
{
if (strstr (buf, "Network is unreachable") ||
strstr (buf, "Destination Net Unreachable")
strstr (buf, "Destination Net Unreachable") ||
strstr (buf, "No route")
)
die (STATE_CRITICAL, _("CRITICAL - Network Unreachable (%s)\n"), addr);
else if (strstr (buf, "Destination Host Unreachable"))
else if (strstr (buf, "Destination Host Unreachable") || strstr(buf, "Address unreachable"))
die (STATE_CRITICAL, _("CRITICAL - Host Unreachable (%s)\n"), addr);
else if (strstr (buf, "Destination Port Unreachable"))
else if (strstr (buf, "Destination Port Unreachable") || strstr(buf, "Port unreachable"))
die (STATE_CRITICAL, _("CRITICAL - Bogus ICMP: Port Unreachable (%s)\n"), addr);
else if (strstr (buf, "Destination Protocol Unreachable"))
die (STATE_CRITICAL, _("CRITICAL - Bogus ICMP: Protocol Unreachable (%s)\n"), addr);
@ -534,11 +541,11 @@ error_scan (char buf[MAX_INPUT_BUFFER], const char *addr)
die (STATE_CRITICAL, _("CRITICAL - Network Prohibited (%s)\n"), addr);
else if (strstr (buf, "Destination Host Prohibited"))
die (STATE_CRITICAL, _("CRITICAL - Host Prohibited (%s)\n"), addr);
else if (strstr (buf, "Packet filtered"))
else if (strstr (buf, "Packet filtered") || strstr(buf, "Administratively prohibited"))
die (STATE_CRITICAL, _("CRITICAL - Packet Filtered (%s)\n"), addr);
else if (strstr (buf, "unknown host" ))
die (STATE_CRITICAL, _("CRITICAL - Host not found (%s)\n"), addr);
else if (strstr (buf, "Time to live exceeded"))
else if (strstr (buf, "Time to live exceeded") || strstr(buf, "Time exceeded"))
die (STATE_CRITICAL, _("CRITICAL - Time to live exceeded (%s)\n"), addr);
else if (strstr (buf, "Destination unreachable: "))
die (STATE_CRITICAL, _("CRITICAL - Destination Unreachable (%s)\n"), addr);
@ -547,7 +554,7 @@ error_scan (char buf[MAX_INPUT_BUFFER], const char *addr)
if (warn_text == NULL)
warn_text = strdup (_(WARN_DUPLICATES));
else if (! strstr (warn_text, _(WARN_DUPLICATES)) &&
xasprintf (&warn_text, "%s %s", warn_text, _(WARN_DUPLICATES)) == -1)
xasprintf (&warn_text, "%s %s", warn_text, _(WARN_DUPLICATES)) == -1)
die (STATE_UNKNOWN, _("Unable to realloc warn_text\n"));
return (STATE_WARNING);
}
@ -567,7 +574,7 @@ print_help (void)
printf (_("Use ping to check connection statistics for a remote host."));
printf ("\n\n");
printf ("\n\n");
print_usage ();
@ -577,29 +584,29 @@ print_help (void)
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 (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
printf ("\n");
printf ("\n");
printf ("%s\n", _("THRESHOLD is <rta>,<pl>% where <rta> is the round trip average travel"));
printf ("%s\n", _("time (ms) which triggers a WARNING or CRITICAL state, and <pl> 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 <pl> is the"));
printf ("%s\n", _("percentage of packet loss to trigger an alarm state."));
printf ("\n");
printf ("\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 (UT_SUPPORT);
}
@ -607,7 +614,7 @@ print_help (void)
void
print_usage (void)
{
printf ("%s\n", _("Usage:"));
printf ("%s\n", _("Usage:"));
printf ("%s -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n", progname);
printf (" [-p packets] [-t timeout] [-4|-6]\n");
printf (" [-p packets] [-t timeout] [-4|-6]\n");
}