diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-05-18 00:20:36 +0200 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-05-18 00:20:36 +0200 |
| commit | fbcd11acb7ae098db28a778c84756a49b36f83ef (patch) | |
| tree | 3b56576b80ba1f78d040bf01a38cceaeca5817e5 | |
| parent | a01d522c4cac11eb31510758d42fe744eb21471d (diff) | |
| download | monitoring-plugins-fbcd11acb7ae098db28a778c84756a49b36f83ef.tar.gz | |
Clang-format
| -rw-r--r-- | plugins-root/check_icmp.c | 25 | ||||
| -rw-r--r-- | plugins-root/check_icmp.d/check_icmp_helpers.h | 2 |
2 files changed, 13 insertions, 14 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 34adf6fe..58f5ae70 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
| @@ -878,14 +878,14 @@ int main(int argc, char **argv) { | |||
| 878 | 878 | ||
| 879 | check_icmp_state program_state = check_icmp_state_init(); | 879 | check_icmp_state program_state = check_icmp_state_init(); |
| 880 | 880 | ||
| 881 | run_checks(config.modes, config.min_hosts_alive, config.icmp_data_size, | 881 | run_checks(config.modes, config.min_hosts_alive, config.icmp_data_size, &pkt_interval, |
| 882 | &pkt_interval, &target_interval, config.warn, config.crit, config.sender_id, | 882 | &target_interval, config.warn, config.crit, config.sender_id, config.mode, |
| 883 | config.mode, max_completion_time, prog_start, table, config.number_of_packets, | 883 | max_completion_time, prog_start, table, config.number_of_packets, icmp_sock, |
| 884 | icmp_sock, config.number_of_targets, &program_state, config.targets); | 884 | config.number_of_targets, &program_state, config.targets); |
| 885 | 885 | ||
| 886 | errno = 0; | 886 | errno = 0; |
| 887 | finish(0, config.modes, config.min_hosts_alive, config.warn, config.crit, | 887 | finish(0, config.modes, config.min_hosts_alive, config.warn, config.crit, icmp_sock, |
| 888 | icmp_sock, config.number_of_targets, &program_state, config.targets); | 888 | config.number_of_targets, &program_state, config.targets); |
| 889 | 889 | ||
| 890 | return (0); | 890 | return (0); |
| 891 | } | 891 | } |
| @@ -906,9 +906,8 @@ static void run_checks(check_icmp_mode_switches modes, int min_hosts_alive, | |||
| 906 | for (unsigned int target_index = 0; target_index < number_of_targets; target_index++) { | 906 | for (unsigned int target_index = 0; target_index < number_of_targets; target_index++) { |
| 907 | /* don't send useless packets */ | 907 | /* don't send useless packets */ |
| 908 | if (!targets_alive(number_of_targets, program_state->targets_down)) { | 908 | if (!targets_alive(number_of_targets, program_state->targets_down)) { |
| 909 | finish(0, modes, | 909 | finish(0, modes, min_hosts_alive, warn, crit, icmp_sock, number_of_targets, |
| 910 | min_hosts_alive, warn, crit, icmp_sock, number_of_targets, program_state, | 910 | program_state, target_list); |
| 911 | target_list); | ||
| 912 | } | 911 | } |
| 913 | if (table[target_index]->flags & FLAG_LOST_CAUSE) { | 912 | if (table[target_index]->flags & FLAG_LOST_CAUSE) { |
| 914 | if (debug) { | 913 | if (debug) { |
| @@ -953,9 +952,8 @@ static void run_checks(check_icmp_mode_switches modes, int min_hosts_alive, | |||
| 953 | if (debug) { | 952 | if (debug) { |
| 954 | printf("Time passed. Finishing up\n"); | 953 | printf("Time passed. Finishing up\n"); |
| 955 | } | 954 | } |
| 956 | finish(0, modes, | 955 | finish(0, modes, min_hosts_alive, warn, crit, icmp_sock, number_of_targets, |
| 957 | min_hosts_alive, warn, crit, icmp_sock, number_of_targets, program_state, | 956 | program_state, target_list); |
| 958 | target_list); | ||
| 959 | } | 957 | } |
| 960 | 958 | ||
| 961 | /* catch the packets that might come in within the timeframe, but | 959 | /* catch the packets that might come in within the timeframe, but |
| @@ -2065,7 +2063,8 @@ static add_host_wrapper add_host(char *arg, check_icmp_execution_mode mode) { | |||
| 2065 | mp_subcheck evaluate_target(ping_target target, check_icmp_mode_switches modes, | 2063 | mp_subcheck evaluate_target(ping_target target, check_icmp_mode_switches modes, |
| 2066 | check_icmp_threshold warn, check_icmp_threshold crit) { | 2064 | check_icmp_threshold warn, check_icmp_threshold crit) { |
| 2067 | /* if no new mode selected, use old schema */ | 2065 | /* if no new mode selected, use old schema */ |
| 2068 | if (!modes.rta_mode && !modes.pl_mode && !modes.jitter_mode && !modes.score_mode && !modes.mos_mode && !modes.order_mode) { | 2066 | if (!modes.rta_mode && !modes.pl_mode && !modes.jitter_mode && !modes.score_mode && |
| 2067 | !modes.mos_mode && !modes.order_mode) { | ||
| 2069 | modes.rta_mode = true; | 2068 | modes.rta_mode = true; |
| 2070 | modes.pl_mode = true; | 2069 | modes.pl_mode = true; |
| 2071 | } | 2070 | } |
diff --git a/plugins-root/check_icmp.d/check_icmp_helpers.h b/plugins-root/check_icmp.d/check_icmp_helpers.h index 68c39b4a..5f771635 100644 --- a/plugins-root/check_icmp.d/check_icmp_helpers.h +++ b/plugins-root/check_icmp.d/check_icmp_helpers.h | |||
| @@ -15,7 +15,7 @@ typedef struct rta_host { | |||
| 15 | char *msg; /* icmp error message, if any */ | 15 | char *msg; /* icmp error message, if any */ |
| 16 | struct sockaddr_storage saddr_in; /* the address of this host */ | 16 | struct sockaddr_storage saddr_in; /* the address of this host */ |
| 17 | struct sockaddr_storage error_addr; /* stores address of error replies */ | 17 | struct sockaddr_storage error_addr; /* stores address of error replies */ |
| 18 | time_t time_waited; /* total time waited, in usecs */ | 18 | time_t time_waited; /* total time waited, in usecs */ |
| 19 | unsigned int icmp_sent, icmp_recv, icmp_lost; /* counters */ | 19 | unsigned int icmp_sent, icmp_recv, icmp_lost; /* counters */ |
| 20 | unsigned char icmp_type, icmp_code; /* type and code from errors */ | 20 | unsigned char icmp_type, icmp_code; /* type and code from errors */ |
| 21 | unsigned short flags; /* control/status flags */ | 21 | unsigned short flags; /* control/status flags */ |
