New upstream version 2.4.0

This commit is contained in:
Jan Wagner 2024-07-23 20:21:44 +00:00
parent d5a5faa95b
commit 600e193ca4
102 changed files with 16219 additions and 31778 deletions

View file

@ -59,16 +59,16 @@ int packet_size = PACKET_SIZE;
int packet_count = PACKET_COUNT;
int target_timeout = 0;
int packet_interval = 0;
int verbose = FALSE;
bool verbose = false;
int cpl;
int wpl;
double crta;
double wrta;
int cpl_p = FALSE;
int wpl_p = FALSE;
bool alive_p = FALSE;
int crta_p = FALSE;
int wrta_p = FALSE;
bool cpl_p = false;
bool wpl_p = false;
bool alive_p = false;
bool crta_p = false;
bool wrta_p = false;
int
main (int argc, char **argv)
@ -194,8 +194,8 @@ int textscan (char *buf) {
_("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));
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")) {
@ -228,21 +228,21 @@ int textscan (char *buf) {
rtastr = 1 + index (rtastr, '/');
loss = strtod (losstr, NULL);
rta = strtod (rtastr, NULL);
if (cpl_p == TRUE && loss > cpl)
if (cpl_p && loss > cpl)
status = STATE_CRITICAL;
else if (crta_p == TRUE && rta > crta)
else if (crta_p && rta > crta)
status = STATE_CRITICAL;
else if (wpl_p == TRUE && loss > wpl)
else if (wpl_p && loss > wpl)
status = STATE_WARNING;
else if (wrta_p == TRUE && rta > wrta)
else if (wrta_p && rta > wrta)
status = STATE_WARNING;
else
status = STATE_OK;
die (status,
_("FPING %s - %s (loss=%.0f%%, rta=%f ms)|%s %s\n"),
state_text (status), server_name, loss, rta,
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));
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));
}
else if(strstr (buf, "xmt/rcv/%loss") ) {
@ -258,16 +258,16 @@ int textscan (char *buf) {
loss = strtod (losstr, NULL);
if (atoi(losstr) == 100)
status = STATE_CRITICAL;
else if (cpl_p == TRUE && loss > cpl)
else if (cpl_p && loss > cpl)
status = STATE_CRITICAL;
else if (wpl_p == TRUE && loss > wpl)
else if (wpl_p && loss > wpl)
status = STATE_WARNING;
else
status = STATE_OK;
/* loss=%.0f%%;%d;%d;0;100 */
die (status, _("FPING %s - %s (loss=%.0f%% )|%s\n"),
state_text (status), server_name, loss ,
perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, TRUE, 0, TRUE, 100));
perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, true, 0, true, 100));
}
else {
@ -329,7 +329,7 @@ process_arguments (int argc, char **argv)
case '?': /* print short usage statement if args not parsable */
usage5 ();
case 'a': /* host alive mode */
alive_p = TRUE;
alive_p = true;
break;
case 'h': /* help */
print_help ();
@ -338,16 +338,16 @@ process_arguments (int argc, char **argv)
print_revision (progname, NP_VERSION);
exit (STATE_UNKNOWN);
case 'v': /* verbose mode */
verbose = TRUE;
verbose = true;
break;
case 'H': /* hostname */
if (is_host (optarg) == FALSE) {
if (is_host (optarg) == false) {
usage2 (_("Invalid hostname/address"), optarg);
}
server_name = strscpy (server_name, optarg);
break;
case 'S': /* sourceip */
if (is_host (optarg) == FALSE) {
if (is_host (optarg) == false) {
usage2 (_("Invalid hostname/address"), optarg);
}
sourceip = strscpy (sourceip, optarg);
@ -369,12 +369,12 @@ process_arguments (int argc, char **argv)
get_threshold (optarg, rv);
if (rv[RTA]) {
crta = strtod (rv[RTA], NULL);
crta_p = TRUE;
crta_p = true;
rv[RTA] = NULL;
}
if (rv[PL]) {
cpl = atoi (rv[PL]);
cpl_p = TRUE;
cpl_p = true;
rv[PL] = NULL;
}
break;
@ -382,12 +382,12 @@ process_arguments (int argc, char **argv)
get_threshold (optarg, rv);
if (rv[RTA]) {
wrta = strtod (rv[RTA], NULL);
wrta_p = TRUE;
wrta_p = true;
rv[RTA] = NULL;
}
if (rv[PL]) {
wpl = atoi (rv[PL]);
wpl_p = TRUE;
wpl_p = true;
rv[PL] = NULL;
}
break;