diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-12 18:40:14 +0100 |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-12 18:40:14 +0100 |
commit | 29b1be07c81099013317b10f25c5f48f6d40312b (patch) | |
tree | 3b616ad8c7e9e4d248e0380d5a5de353260a7702 /plugins/check_ups.d/config.h | |
parent | 399121ed0d69a83cce483ce6b762ad48937a3c70 (diff) | |
download | monitoring-plugins-29b1be07c81099013317b10f25c5f48f6d40312b.tar.gz |
Refactor check_ups
Diffstat (limited to 'plugins/check_ups.d/config.h')
-rw-r--r-- | plugins/check_ups.d/config.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/plugins/check_ups.d/config.h b/plugins/check_ups.d/config.h new file mode 100644 index 00000000..353104f2 --- /dev/null +++ b/plugins/check_ups.d/config.h | |||
@@ -0,0 +1,55 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #include "../../config.h" | ||
4 | #include <stddef.h> | ||
5 | |||
6 | #define UPS_NONE 0 /* no supported options */ | ||
7 | #define UPS_UTILITY 1 /* supports utility line */ | ||
8 | #define UPS_BATTPCT 2 /* supports percent battery remaining */ | ||
9 | #define UPS_STATUS 4 /* supports UPS status */ | ||
10 | #define UPS_TEMP 8 /* supports UPS temperature */ | ||
11 | #define UPS_LOADPCT 16 /* supports load percent */ | ||
12 | #define UPS_REALPOWER 32 /* supports real power */ | ||
13 | |||
14 | #define UPSSTATUS_NONE 0 | ||
15 | #define UPSSTATUS_OFF 1 | ||
16 | #define UPSSTATUS_OL 2 | ||
17 | #define UPSSTATUS_OB 4 | ||
18 | #define UPSSTATUS_LB 8 | ||
19 | #define UPSSTATUS_CAL 16 | ||
20 | #define UPSSTATUS_RB 32 /*Replace Battery */ | ||
21 | #define UPSSTATUS_BYPASS 64 | ||
22 | #define UPSSTATUS_OVER 128 | ||
23 | #define UPSSTATUS_TRIM 256 | ||
24 | #define UPSSTATUS_BOOST 512 | ||
25 | #define UPSSTATUS_CHRG 1024 | ||
26 | #define UPSSTATUS_DISCHRG 2048 | ||
27 | #define UPSSTATUS_UNKNOWN 4096 | ||
28 | #define UPSSTATUS_ALARM 8192 | ||
29 | |||
30 | enum { | ||
31 | PORT = 3493 | ||
32 | }; | ||
33 | |||
34 | typedef struct ups_config { | ||
35 | unsigned int server_port; | ||
36 | char *server_address; | ||
37 | char *ups_name; | ||
38 | double warning_value; | ||
39 | double critical_value; | ||
40 | bool check_warn; | ||
41 | bool check_crit; | ||
42 | int check_variable; | ||
43 | bool temp_output_c; | ||
44 | } check_ups_config; | ||
45 | |||
46 | check_ups_config check_ups_config_init(void) { | ||
47 | check_ups_config tmp = {0}; | ||
48 | tmp.server_port = PORT; | ||
49 | tmp.server_address = NULL; | ||
50 | tmp.ups_name = NULL; | ||
51 | tmp.check_variable = UPS_NONE; | ||
52 | |||
53 | return tmp; | ||
54 | } | ||
55 | |||