diff options
Diffstat (limited to 'plugins/check_swap.d/check_swap.h')
| -rw-r--r-- | plugins/check_swap.d/check_swap.h | 49 |
1 files changed, 49 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..8d3c7fcf --- /dev/null +++ b/plugins/check_swap.d/check_swap.h | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../common.h" | ||
| 4 | #include "../../lib/output.h" | ||
| 5 | #include "../../lib/states.h" | ||
| 6 | |||
| 7 | #ifndef SWAP_CONVERSION | ||
| 8 | # define SWAP_CONVERSION 1 | ||
| 9 | #endif | ||
| 10 | |||
| 11 | typedef struct { | ||
| 12 | bool is_percentage; | ||
| 13 | uint64_t value; | ||
| 14 | } check_swap_threshold; | ||
| 15 | |||
| 16 | typedef struct { | ||
| 17 | unsigned long long free; // Free swap in Bytes! | ||
| 18 | unsigned long long used; // Used swap in Bytes! | ||
| 19 | unsigned long long total; // Total swap size, you guessed it, in Bytes! | ||
| 20 | } swap_metrics; | ||
| 21 | |||
| 22 | typedef struct { | ||
| 23 | int errorcode; | ||
| 24 | int statusCode; | ||
| 25 | swap_metrics metrics; | ||
| 26 | } swap_result; | ||
| 27 | |||
| 28 | typedef struct { | ||
| 29 | bool allswaps; | ||
| 30 | mp_state_enum no_swap_state; | ||
| 31 | bool warn_is_set; | ||
| 32 | check_swap_threshold warn; | ||
| 33 | bool crit_is_set; | ||
| 34 | check_swap_threshold crit; | ||
| 35 | bool on_aix; | ||
| 36 | int conversion_factor; | ||
| 37 | |||
| 38 | bool output_format_is_set; | ||
| 39 | mp_output_format output_format; | ||
| 40 | } swap_config; | ||
| 41 | |||
| 42 | swap_config swap_config_init(void); | ||
| 43 | |||
| 44 | swap_result get_swap_data(swap_config config); | ||
| 45 | swap_result getSwapFromProcMeminfo(char path_to_proc_meminfo[]); | ||
| 46 | swap_result getSwapFromSwapCommand(swap_config config, const char swap_command[], | ||
| 47 | const char swap_format[]); | ||
| 48 | swap_result getSwapFromSwapctl_BSD(swap_config config); | ||
| 49 | swap_result getSwapFromSwap_SRV4(swap_config config); | ||
