diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-11-27 15:28:53 +0100 |
---|---|---|
committer | Sven Nierlein <sven@nierlein.org> | 2024-11-28 09:02:29 +0100 |
commit | 714fd1aceb22014eae64be288fa148bbbf835e33 (patch) | |
tree | 47626b848ca7e66b70a36e012adf45fd266ccaad | |
parent | eb9f9cf8c47fc37553cc17d349a47c9dab0a5e8b (diff) | |
download | monitoring-plugins-714fd1aceb22014eae64be288fa148bbbf835e33.tar.gz |
check_icmp: Add some lines to introduce some readability
-rw-r--r-- | plugins-root/check_icmp.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index ea17b3a8..e6a00960 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) { | |||
1095 | host->time_waited += tdiff; | 1095 | host->time_waited += tdiff; |
1096 | host->icmp_recv++; | 1096 | host->icmp_recv++; |
1097 | icmp_recv++; | 1097 | icmp_recv++; |
1098 | |||
1098 | if (tdiff > (unsigned int)host->rtmax) { | 1099 | if (tdiff > (unsigned int)host->rtmax) { |
1099 | host->rtmax = tdiff; | 1100 | host->rtmax = tdiff; |
1100 | } | 1101 | } |
@@ -1503,10 +1504,10 @@ static void finish(int sig) { | |||
1503 | 1504 | ||
1504 | host = list; | 1505 | host = list; |
1505 | while (host) { | 1506 | while (host) { |
1506 | |||
1507 | if (debug) { | 1507 | if (debug) { |
1508 | puts(""); | 1508 | puts(""); |
1509 | } | 1509 | } |
1510 | |||
1510 | if (i) { | 1511 | if (i) { |
1511 | if (i < targets) { | 1512 | if (i < targets) { |
1512 | printf(" :: "); | 1513 | printf(" :: "); |
@@ -1514,11 +1515,14 @@ static void finish(int sig) { | |||
1514 | printf("\n"); | 1515 | printf("\n"); |
1515 | } | 1516 | } |
1516 | } | 1517 | } |
1518 | |||
1517 | i++; | 1519 | i++; |
1520 | |||
1518 | if (!host->icmp_recv) { | 1521 | if (!host->icmp_recv) { |
1519 | status = STATE_CRITICAL; | 1522 | status = STATE_CRITICAL; |
1520 | host->rtmin = 0; | 1523 | host->rtmin = 0; |
1521 | host->jitter_min = 0; | 1524 | host->jitter_min = 0; |
1525 | |||
1522 | if (host->flags & FLAG_LOST_CAUSE) { | 1526 | if (host->flags & FLAG_LOST_CAUSE) { |
1523 | char address[INET6_ADDRSTRLEN]; | 1527 | char address[INET6_ADDRSTRLEN]; |
1524 | parse_address(&host->error_addr, address, sizeof(address)); | 1528 | parse_address(&host->error_addr, address, sizeof(address)); |
@@ -1538,6 +1542,7 @@ static void finish(int sig) { | |||
1538 | printf(" rta %0.3fms > %0.3fms", (float)host->rta / 1000, (float)crit.rta / 1000); | 1542 | printf(" rta %0.3fms > %0.3fms", (float)host->rta / 1000, (float)crit.rta / 1000); |
1539 | } | 1543 | } |
1540 | } | 1544 | } |
1545 | |||
1541 | /* pl text output */ | 1546 | /* pl text output */ |
1542 | if (pl_mode) { | 1547 | if (pl_mode) { |
1543 | if (status == STATE_OK) { | 1548 | if (status == STATE_OK) { |
@@ -1548,6 +1553,7 @@ static void finish(int sig) { | |||
1548 | printf(" lost %u%% > %u%%", host->pl, crit.pl); | 1553 | printf(" lost %u%% > %u%%", host->pl, crit.pl); |
1549 | } | 1554 | } |
1550 | } | 1555 | } |
1556 | |||
1551 | /* jitter text output */ | 1557 | /* jitter text output */ |
1552 | if (jitter_mode) { | 1558 | if (jitter_mode) { |
1553 | if (status == STATE_OK) { | 1559 | if (status == STATE_OK) { |
@@ -1558,6 +1564,7 @@ static void finish(int sig) { | |||
1558 | printf(" jitter %0.3fms > %0.3fms", (float)host->jitter, crit.jitter); | 1564 | printf(" jitter %0.3fms > %0.3fms", (float)host->jitter, crit.jitter); |
1559 | } | 1565 | } |
1560 | } | 1566 | } |
1567 | |||
1561 | /* mos text output */ | 1568 | /* mos text output */ |
1562 | if (mos_mode) { | 1569 | if (mos_mode) { |
1563 | if (status == STATE_OK) { | 1570 | if (status == STATE_OK) { |
@@ -1568,6 +1575,7 @@ static void finish(int sig) { | |||
1568 | printf(" MOS %0.1f < %0.1f", (float)host->mos, (float)crit.mos); | 1575 | printf(" MOS %0.1f < %0.1f", (float)host->mos, (float)crit.mos); |
1569 | } | 1576 | } |
1570 | } | 1577 | } |
1578 | |||
1571 | /* score text output */ | 1579 | /* score text output */ |
1572 | if (score_mode) { | 1580 | if (score_mode) { |
1573 | if (status == STATE_OK) { | 1581 | if (status == STATE_OK) { |
@@ -1578,6 +1586,7 @@ static void finish(int sig) { | |||
1578 | printf(" Score %u < %u", (int)host->score, (int)crit.score); | 1586 | printf(" Score %u < %u", (int)host->score, (int)crit.score); |
1579 | } | 1587 | } |
1580 | } | 1588 | } |
1589 | |||
1581 | /* order statis text output */ | 1590 | /* order statis text output */ |
1582 | if (order_mode) { | 1591 | if (order_mode) { |
1583 | if (status == STATE_OK) { | 1592 | if (status == STATE_OK) { |