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.h47
1 files changed, 47 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..1000fc9e
--- /dev/null
+++ b/plugins/check_swap.d/check_swap.h
@@ -0,0 +1,47 @@
1#pragma once
2
3#include "../common.h"
4#include "output.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} check_swap_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 bool warn_is_set;
31 check_swap_threshold warn;
32 bool crit_is_set;
33 check_swap_threshold crit;
34 bool on_aix;
35 int conversion_factor;
36
37 bool output_format_is_set;
38 mp_output_format output_format;
39} swap_config;
40
41swap_config swap_config_init(void);
42
43swap_result get_swap_data(swap_config config);
44swap_result getSwapFromProcMeminfo(char path_to_proc_meminfo[]);
45swap_result getSwapFromSwapCommand(swap_config config, const char swap_command[], const char swap_format[]);
46swap_result getSwapFromSwapctl_BSD(swap_config config);
47swap_result getSwapFromSwap_SRV4(swap_config config);