New upstream version 2.3.2
This commit is contained in:
parent
09f4277f49
commit
21323d25dd
104 changed files with 34386 additions and 7430 deletions
|
@ -37,6 +37,7 @@ const char *email = "devel@monitoring-plugins.org";
|
|||
#include "popen.h"
|
||||
#include "netutils.h"
|
||||
#include "utils.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
enum {
|
||||
PACKET_COUNT = 1,
|
||||
|
@ -65,6 +66,7 @@ double crta;
|
|||
double wrta;
|
||||
int cpl_p = FALSE;
|
||||
int wpl_p = FALSE;
|
||||
bool alive_p = FALSE;
|
||||
int crta_p = FALSE;
|
||||
int wrta_p = FALSE;
|
||||
|
||||
|
@ -147,9 +149,11 @@ main (int argc, char **argv)
|
|||
(void) fclose (child_stderr);
|
||||
|
||||
/* close the pipe */
|
||||
if (result = spclose (child_process))
|
||||
result = spclose (child_process);
|
||||
if (result) {
|
||||
/* need to use max_state not max */
|
||||
status = max_state (status, STATE_WARNING);
|
||||
}
|
||||
|
||||
if (result > 1 ) {
|
||||
status = max_state (status, STATE_UNKNOWN);
|
||||
|
@ -171,10 +175,7 @@ main (int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
textscan (char *buf)
|
||||
{
|
||||
int textscan (char *buf) {
|
||||
char *rtastr = NULL;
|
||||
char *losstr = NULL;
|
||||
char *xmtstr = NULL;
|
||||
|
@ -183,6 +184,20 @@ textscan (char *buf)
|
|||
double xmt;
|
||||
int status = STATE_UNKNOWN;
|
||||
|
||||
/* stops testing after the first successful reply. */
|
||||
if (alive_p && strstr(buf, "avg, 0% loss)")) {
|
||||
rtastr = strstr (buf, "ms (");
|
||||
rtastr = 1 + index(rtastr, '(');
|
||||
rta = strtod(rtastr, NULL);
|
||||
loss=strtod("0",NULL);
|
||||
die (STATE_OK,
|
||||
_("FPING %s - %s (rta=%f ms)|%s\n"),
|
||||
state_text (STATE_OK), server_name,rta,
|
||||
/* No loss since we only waited for the first reply
|
||||
perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, TRUE, 0, TRUE, 100), */
|
||||
fperfdata ("rta", rta/1.0e3, "s", wrta_p, wrta/1.0e3, crta_p, crta/1.0e3, TRUE, 0, FALSE, 0));
|
||||
}
|
||||
|
||||
if (strstr (buf, "not found")) {
|
||||
die (STATE_CRITICAL, _("FPING UNKNOWN - %s not found\n"), server_name);
|
||||
|
||||
|
@ -278,6 +293,7 @@ process_arguments (int argc, char **argv)
|
|||
{"sourceif", required_argument, 0, 'I'},
|
||||
{"critical", required_argument, 0, 'c'},
|
||||
{"warning", required_argument, 0, 'w'},
|
||||
{"alive", no_argument, 0, 'a'},
|
||||
{"bytes", required_argument, 0, 'b'},
|
||||
{"number", required_argument, 0, 'n'},
|
||||
{"target-timeout", required_argument, 0, 'T'},
|
||||
|
@ -304,7 +320,7 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "+hVvH:S:c:w:b:n:T:i:I:46", longopts, &option);
|
||||
c = getopt_long (argc, argv, "+hVvaH:S:c:w:b:n:T:i:I:46", longopts, &option);
|
||||
|
||||
if (c == -1 || c == EOF || c == 1)
|
||||
break;
|
||||
|
@ -312,6 +328,9 @@ process_arguments (int argc, char **argv)
|
|||
switch (c) {
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
usage5 ();
|
||||
case 'a': /* host alive mode */
|
||||
alive_p = TRUE;
|
||||
break;
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_UNKNOWN);
|
||||
|
@ -446,9 +465,7 @@ get_threshold (char *arg, char *rv[2])
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
print_help (void)
|
||||
{
|
||||
void print_help (void) {
|
||||
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
|
@ -474,6 +491,8 @@ print_help (void)
|
|||
printf (" %s\n", _("warning threshold pair"));
|
||||
printf (" %s\n", "-c, --critical=THRESHOLD");
|
||||
printf (" %s\n", _("critical threshold pair"));
|
||||
printf (" %s\n", "-a, --alive");
|
||||
printf (" %s\n", _("Return OK after first successfull reply"));
|
||||
printf (" %s\n", "-b, --bytes=INTEGER");
|
||||
printf (" %s (default: %d)\n", _("size of ICMP packet"),PACKET_SIZE);
|
||||
printf (" %s\n", "-n, --number=INTEGER");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue