diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-05-17 11:26:54 +0200 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-05-17 11:49:06 +0200 |
| commit | a01d522c4cac11eb31510758d42fe744eb21471d (patch) | |
| tree | 3e84b71d064621c1833317651e1c554cebd376c6 /plugins-root/check_icmp.d | |
| parent | 322cd6f829e55a91edbfc42201775afb552b5660 (diff) | |
| download | monitoring-plugins-a01d522c4cac11eb31510758d42fe744eb21471d.tar.gz | |
WIP - check_icmp refactor 6
Diffstat (limited to 'plugins-root/check_icmp.d')
| -rw-r--r-- | plugins-root/check_icmp.d/check_icmp_helpers.c | 22 | ||||
| -rw-r--r-- | plugins-root/check_icmp.d/check_icmp_helpers.h | 13 | ||||
| -rw-r--r-- | plugins-root/check_icmp.d/config.h | 4 |
3 files changed, 15 insertions, 24 deletions
diff --git a/plugins-root/check_icmp.d/check_icmp_helpers.c b/plugins-root/check_icmp.d/check_icmp_helpers.c index 58e13581..a2b54c6a 100644 --- a/plugins-root/check_icmp.d/check_icmp_helpers.c +++ b/plugins-root/check_icmp.d/check_icmp_helpers.c | |||
| @@ -10,12 +10,15 @@ unsigned int timeout = DEFAULT_TIMEOUT; | |||
| 10 | 10 | ||
| 11 | check_icmp_config check_icmp_config_init() { | 11 | check_icmp_config check_icmp_config_init() { |
| 12 | check_icmp_config tmp = { | 12 | check_icmp_config tmp = { |
| 13 | .order_mode = false, | 13 | .modes = |
| 14 | .mos_mode = false, | 14 | { |
| 15 | .rta_mode = false, | 15 | .order_mode = false, |
| 16 | .pl_mode = false, | 16 | .mos_mode = false, |
| 17 | .jitter_mode = false, | 17 | .rta_mode = false, |
| 18 | .score_mode = false, | 18 | .pl_mode = false, |
| 19 | .jitter_mode = false, | ||
| 20 | .score_mode = false, | ||
| 21 | }, | ||
| 19 | 22 | ||
| 20 | .min_hosts_alive = -1, | 23 | .min_hosts_alive = -1, |
| 21 | .crit = {.pl = DEFAULT_CRIT_PL, | 24 | .crit = {.pl = DEFAULT_CRIT_PL, |
| @@ -56,12 +59,7 @@ ping_target ping_target_init() { | |||
| 56 | 59 | ||
| 57 | .jitter_min = INFINITY, | 60 | .jitter_min = INFINITY, |
| 58 | 61 | ||
| 59 | .rta_status = STATE_OK, | 62 | .found_out_of_order_packets = false, |
| 60 | .jitter_status = STATE_OK, | ||
| 61 | .mos_status = STATE_OK, | ||
| 62 | .score_status = STATE_OK, | ||
| 63 | .pl_status = STATE_OK, | ||
| 64 | .order_status = STATE_OK, | ||
| 65 | }; | 63 | }; |
| 66 | 64 | ||
| 67 | return tmp; | 65 | return tmp; |
diff --git a/plugins-root/check_icmp.d/check_icmp_helpers.h b/plugins-root/check_icmp.d/check_icmp_helpers.h index 3e798f72..68c39b4a 100644 --- a/plugins-root/check_icmp.d/check_icmp_helpers.h +++ b/plugins-root/check_icmp.d/check_icmp_helpers.h | |||
| @@ -20,7 +20,6 @@ typedef struct rta_host { | |||
| 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 */ |
| 22 | 22 | ||
| 23 | double rta; /* measured RTA */ | ||
| 24 | double rtmax; /* max rtt */ | 23 | double rtmax; /* max rtt */ |
| 25 | double rtmin; /* min rtt */ | 24 | double rtmin; /* min rtt */ |
| 26 | 25 | ||
| @@ -28,20 +27,10 @@ typedef struct rta_host { | |||
| 28 | double jitter_max; /* jitter rtt maximum */ | 27 | double jitter_max; /* jitter rtt maximum */ |
| 29 | double jitter_min; /* jitter rtt minimum */ | 28 | double jitter_min; /* jitter rtt minimum */ |
| 30 | 29 | ||
| 31 | double EffectiveLatency; | ||
| 32 | double mos; /* Mean opinion score */ | ||
| 33 | double score; /* score */ | ||
| 34 | |||
| 35 | time_t last_tdiff; | 30 | time_t last_tdiff; |
| 36 | unsigned int last_icmp_seq; /* Last ICMP_SEQ to check out of order pkts */ | 31 | unsigned int last_icmp_seq; /* Last ICMP_SEQ to check out of order pkts */ |
| 37 | unsigned char pl; /* measured packet loss */ | ||
| 38 | 32 | ||
| 39 | mp_state_enum rta_status; // check result for RTA checks | 33 | bool found_out_of_order_packets; |
| 40 | mp_state_enum jitter_status; // check result for Jitter checks | ||
| 41 | mp_state_enum mos_status; // check result for MOS checks | ||
| 42 | mp_state_enum score_status; // check result for score checks | ||
| 43 | mp_state_enum pl_status; // check result for packet loss checks | ||
| 44 | mp_state_enum order_status; // check result for packet order checks | ||
| 45 | 34 | ||
| 46 | struct rta_host *next; | 35 | struct rta_host *next; |
| 47 | } ping_target; | 36 | } ping_target; |
diff --git a/plugins-root/check_icmp.d/config.h b/plugins-root/check_icmp.d/config.h index 3599c0f0..aa33c991 100644 --- a/plugins-root/check_icmp.d/config.h +++ b/plugins-root/check_icmp.d/config.h | |||
| @@ -48,6 +48,10 @@ typedef struct { | |||
| 48 | bool pl_mode; | 48 | bool pl_mode; |
| 49 | bool jitter_mode; | 49 | bool jitter_mode; |
| 50 | bool score_mode; | 50 | bool score_mode; |
| 51 | } check_icmp_mode_switches; | ||
| 52 | |||
| 53 | typedef struct { | ||
| 54 | check_icmp_mode_switches modes; | ||
| 51 | 55 | ||
| 52 | int min_hosts_alive; | 56 | int min_hosts_alive; |
| 53 | check_icmp_threshold crit; | 57 | check_icmp_threshold crit; |
