diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-01-07 11:25:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-07 11:25:47 +0100 |
commit | 558aca48ed764c46fce74c53312ce0d445ee3953 (patch) | |
tree | a90ce1e2f9916093bc82bf0cede4fd5b85b83f5e /plugins/check_swap.d/check_swap.h | |
parent | e445a386f8ad1166b05fcdfdb5b9cde4622a8632 (diff) | |
parent | a8ac865e67cdd88657ac6ece4524c09360dd824e (diff) | |
download | monitoring-plugins-558aca48ed764c46fce74c53312ce0d445ee3953.tar.gz |
Merge branch 'master' into fix_check_http_state_regex
Diffstat (limited to 'plugins/check_swap.d/check_swap.h')
-rw-r--r-- | plugins/check_swap.d/check_swap.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/plugins/check_swap.d/check_swap.h b/plugins/check_swap.d/check_swap.h new file mode 100644 index 00000000..99039b21 --- /dev/null +++ b/plugins/check_swap.d/check_swap.h | |||
@@ -0,0 +1,43 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #include "../common.h" | ||
4 | |||
5 | #ifndef SWAP_CONVERSION | ||
6 | # define SWAP_CONVERSION 1 | ||
7 | #endif | ||
8 | |||
9 | typedef struct { | ||
10 | bool is_percentage; | ||
11 | uint64_t value; | ||
12 | } check_swap_threshold; | ||
13 | |||
14 | typedef struct { | ||
15 | unsigned long long free; // Free swap in Bytes! | ||
16 | unsigned long long used; // Used swap in Bytes! | ||
17 | unsigned long long total; // Total swap size, you guessed it, in Bytes! | ||
18 | } swap_metrics; | ||
19 | |||
20 | typedef struct { | ||
21 | int errorcode; | ||
22 | int statusCode; | ||
23 | swap_metrics metrics; | ||
24 | } swap_result; | ||
25 | |||
26 | typedef struct { | ||
27 | bool allswaps; | ||
28 | int no_swap_state; | ||
29 | bool warn_is_set; | ||
30 | check_swap_threshold warn; | ||
31 | bool crit_is_set; | ||
32 | check_swap_threshold crit; | ||
33 | bool on_aix; | ||
34 | int conversion_factor; | ||
35 | } swap_config; | ||
36 | |||
37 | swap_config swap_config_init(void); | ||
38 | |||
39 | swap_result get_swap_data(swap_config config); | ||
40 | swap_result getSwapFromProcMeminfo(char path_to_proc_meminfo[]); | ||
41 | swap_result getSwapFromSwapCommand(swap_config config, const char swap_command[], const char swap_format[]); | ||
42 | swap_result getSwapFromSwapctl_BSD(swap_config config); | ||
43 | swap_result getSwapFromSwap_SRV4(swap_config config); | ||