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