diff options
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); | ||