[monitoring-plugins] check_icmp: Add some lines to introduce some ...

Sven Nierlein git at monitoring-plugins.org
Thu Nov 28 09:10:12 CET 2024


    Module: monitoring-plugins
    Branch: master
    Commit: 714fd1aceb22014eae64be288fa148bbbf835e33
    Author: Lorenz Kästle <12514511+RincewindsHat at users.noreply.github.com>
 Committer: Sven Nierlein <sven at nierlein.org>
      Date: Wed Nov 27 15:28:53 2024 +0100
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=714fd1a

check_icmp: Add some lines to introduce some readability

---

 plugins-root/check_icmp.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index ea17b3a..e6a0096 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -1095,6 +1095,7 @@ static int wait_for_reply(int sock, u_int t) {
 		host->time_waited += tdiff;
 		host->icmp_recv++;
 		icmp_recv++;
+
 		if (tdiff > (unsigned int)host->rtmax) {
 			host->rtmax = tdiff;
 		}
@@ -1503,10 +1504,10 @@ static void finish(int sig) {
 
 	host = list;
 	while (host) {
-
 		if (debug) {
 			puts("");
 		}
+
 		if (i) {
 			if (i < targets) {
 				printf(" :: ");
@@ -1514,11 +1515,14 @@ static void finish(int sig) {
 				printf("\n");
 			}
 		}
+
 		i++;
+
 		if (!host->icmp_recv) {
 			status = STATE_CRITICAL;
 			host->rtmin = 0;
 			host->jitter_min = 0;
+
 			if (host->flags & FLAG_LOST_CAUSE) {
 				char address[INET6_ADDRSTRLEN];
 				parse_address(&host->error_addr, address, sizeof(address));
@@ -1538,6 +1542,7 @@ static void finish(int sig) {
 					printf(" rta %0.3fms > %0.3fms", (float)host->rta / 1000, (float)crit.rta / 1000);
 				}
 			}
+
 			/* pl text output */
 			if (pl_mode) {
 				if (status == STATE_OK) {
@@ -1548,6 +1553,7 @@ static void finish(int sig) {
 					printf(" lost %u%% > %u%%", host->pl, crit.pl);
 				}
 			}
+
 			/* jitter text output */
 			if (jitter_mode) {
 				if (status == STATE_OK) {
@@ -1558,6 +1564,7 @@ static void finish(int sig) {
 					printf(" jitter %0.3fms > %0.3fms", (float)host->jitter, crit.jitter);
 				}
 			}
+
 			/* mos text output */
 			if (mos_mode) {
 				if (status == STATE_OK) {
@@ -1568,6 +1575,7 @@ static void finish(int sig) {
 					printf(" MOS %0.1f < %0.1f", (float)host->mos, (float)crit.mos);
 				}
 			}
+
 			/* score text output */
 			if (score_mode) {
 				if (status == STATE_OK) {
@@ -1578,6 +1586,7 @@ static void finish(int sig) {
 					printf(" Score %u < %u", (int)host->score, (int)crit.score);
 				}
 			}
+
 			/* order statis text output */
 			if (order_mode) {
 				if (status == STATE_OK) {



More information about the Commits mailing list