diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-05-05 22:52:56 +0200 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-05-05 22:52:56 +0200 |
| commit | 5fd8191a50df6be712c9143ca6d73de7878f57d1 (patch) | |
| tree | 67afdf36446aafa30f7b6daf56895dd233f01b4b /plugins-root/check_icmp.d/config.h | |
| parent | 5a6adcb7db497fba7b89471a6d58dba80330ff4a (diff) | |
| download | monitoring-plugins-5fd8191a50df6be712c9143ca6d73de7878f57d1.tar.gz | |
WIP - check_icmp refactor 3
Diffstat (limited to 'plugins-root/check_icmp.d/config.h')
| -rw-r--r-- | plugins-root/check_icmp.d/config.h | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/plugins-root/check_icmp.d/config.h b/plugins-root/check_icmp.d/config.h index deae9bec..3599c0f0 100644 --- a/plugins-root/check_icmp.d/config.h +++ b/plugins-root/check_icmp.d/config.h | |||
| @@ -10,20 +10,38 @@ | |||
| 10 | #include <netinet/ip_icmp.h> | 10 | #include <netinet/ip_icmp.h> |
| 11 | #include <netinet/icmp6.h> | 11 | #include <netinet/icmp6.h> |
| 12 | #include <arpa/inet.h> | 12 | #include <arpa/inet.h> |
| 13 | #include <stdint.h> | ||
| 13 | #include "./check_icmp_helpers.h" | 14 | #include "./check_icmp_helpers.h" |
| 14 | 15 | ||
| 15 | /* threshold structure. all values are maximum allowed, exclusive */ | 16 | /* threshold structure. all values are maximum allowed, exclusive */ |
| 16 | typedef struct threshold { | 17 | typedef struct { |
| 17 | unsigned char pl; /* max allowed packet loss in percent */ | 18 | unsigned char pl; /* max allowed packet loss in percent */ |
| 18 | unsigned int rta; /* roundtrip time average, microseconds */ | 19 | unsigned int rta; /* roundtrip time average, microseconds */ |
| 19 | double jitter; /* jitter time average, microseconds */ | 20 | double jitter; /* jitter time average, microseconds */ |
| 20 | double mos; /* MOS */ | 21 | double mos; /* MOS */ |
| 21 | double score; /* Score */ | 22 | double score; /* Score */ |
| 22 | } threshold; | 23 | } check_icmp_threshold; |
| 23 | 24 | ||
| 24 | typedef struct { | 25 | /* the different modes of this program are as follows: |
| 25 | char *source_ip; | 26 | * MODE_RTA: send all packets no matter what (mimic check_icmp and check_ping) |
| 27 | * MODE_HOSTCHECK: Return immediately upon any sign of life | ||
| 28 | * In addition, sends packets to ALL addresses assigned | ||
| 29 | * to this host (as returned by gethostbyname() or | ||
| 30 | * gethostbyaddr() and expects one host only to be checked at | ||
| 31 | * a time. Therefore, any packet response what so ever will | ||
| 32 | * count as a sign of life, even when received outside | ||
| 33 | * crit.rta limit. Do not misspell any additional IP's. | ||
| 34 | * MODE_ALL: Requires packets from ALL requested IP to return OK (default). | ||
| 35 | * MODE_ICMP: Default Mode | ||
| 36 | */ | ||
| 37 | typedef enum { | ||
| 38 | MODE_RTA, | ||
| 39 | MODE_HOSTCHECK, | ||
| 40 | MODE_ALL, | ||
| 41 | MODE_ICMP, | ||
| 42 | } check_icmp_execution_mode; | ||
| 26 | 43 | ||
| 44 | typedef struct { | ||
| 27 | bool order_mode; | 45 | bool order_mode; |
| 28 | bool mos_mode; | 46 | bool mos_mode; |
| 29 | bool rta_mode; | 47 | bool rta_mode; |
| @@ -32,18 +50,20 @@ typedef struct { | |||
| 32 | bool score_mode; | 50 | bool score_mode; |
| 33 | 51 | ||
| 34 | int min_hosts_alive; | 52 | int min_hosts_alive; |
| 53 | check_icmp_threshold crit; | ||
| 54 | check_icmp_threshold warn; | ||
| 55 | |||
| 56 | unsigned long ttl; | ||
| 35 | unsigned short icmp_data_size; | 57 | unsigned short icmp_data_size; |
| 36 | unsigned short icmp_pkt_size; | 58 | unsigned short icmp_pkt_size; |
| 37 | unsigned int pkt_interval; | 59 | unsigned int pkt_interval; |
| 38 | unsigned int target_interval; | 60 | unsigned int target_interval; |
| 39 | threshold crit; | 61 | unsigned short number_of_packets; |
| 40 | threshold warn; | 62 | char *source_ip; |
| 41 | pid_t pid; | ||
| 42 | 63 | ||
| 43 | int mode; | 64 | uint16_t sender_id; // PID of the main process, which is used as an ID in packets |
| 44 | unsigned long ttl; | ||
| 45 | 65 | ||
| 46 | unsigned short packets; | 66 | check_icmp_execution_mode mode; |
| 47 | 67 | ||
| 48 | unsigned short number_of_targets; | 68 | unsigned short number_of_targets; |
| 49 | ping_target *targets; | 69 | ping_target *targets; |
| @@ -78,24 +98,6 @@ typedef struct icmp_ping_data { | |||
| 78 | #define DEFAULT_TIMEOUT 10 | 98 | #define DEFAULT_TIMEOUT 10 |
| 79 | #define DEFAULT_TTL 64 | 99 | #define DEFAULT_TTL 64 |
| 80 | 100 | ||
| 81 | /* the different modes of this program are as follows: | ||
| 82 | * MODE_RTA: send all packets no matter what (mimic check_icmp and check_ping) | ||
| 83 | * MODE_HOSTCHECK: Return immediately upon any sign of life | ||
| 84 | * In addition, sends packets to ALL addresses assigned | ||
| 85 | * to this host (as returned by gethostbyname() or | ||
| 86 | * gethostbyaddr() and expects one host only to be checked at | ||
| 87 | * a time. Therefore, any packet response what so ever will | ||
| 88 | * count as a sign of life, even when received outside | ||
| 89 | * crit.rta limit. Do not misspell any additional IP's. | ||
| 90 | * MODE_ALL: Requires packets from ALL requested IP to return OK (default). | ||
| 91 | * MODE_ICMP: implement something similar to check_icmp (MODE_RTA without | ||
| 92 | * tcp and udp args does this) | ||
| 93 | */ | ||
| 94 | #define MODE_RTA 0 | ||
| 95 | #define MODE_HOSTCHECK 1 | ||
| 96 | #define MODE_ALL 2 | ||
| 97 | #define MODE_ICMP 3 | ||
| 98 | |||
| 99 | #define DEFAULT_NUMBER_OF_PACKETS 5 | 101 | #define DEFAULT_NUMBER_OF_PACKETS 5 |
| 100 | 102 | ||
| 101 | #define PACKET_BACKOFF_FACTOR 1.5 | 103 | #define PACKET_BACKOFF_FACTOR 1.5 |
