summaryrefslogtreecommitdiffstats
path: root/plugins/check_ups.d/config.h
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2026-06-08 07:35:45 +0200
committerGitHub <noreply@github.com>2026-06-08 07:35:45 +0200
commit992a4555ac975285f959dd2d3228b1d71ab23123 (patch)
tree7d2566e1051a5d8f61b7f2ec839b086c5898ba0b /plugins/check_ups.d/config.h
parent44e1913da4d227aaabb7b5ccfae65d879082a5e4 (diff)
downloadmonitoring-plugins-992a4555ac975285f959dd2d3228b1d71ab23123.tar.gz
check_ups: implement modern output (#2272)
Co-authored-by: Lorenz Kästle <lorenz.kaestle@netways.de>
Diffstat (limited to 'plugins/check_ups.d/config.h')
-rw-r--r--plugins/check_ups.d/config.h79
1 files changed, 46 insertions, 33 deletions
diff --git a/plugins/check_ups.d/config.h b/plugins/check_ups.d/config.h
index e05edceb..900363fd 100644
--- a/plugins/check_ups.d/config.h
+++ b/plugins/check_ups.d/config.h
@@ -1,31 +1,36 @@
1#pragma once 1#pragma once
2 2
3#include "../../config.h" 3#include "../../config.h"
4#include "thresholds.h"
4#include <stddef.h> 5#include <stddef.h>
5 6
6#define UPS_NONE 0 /* no supported options */ 7typedef enum {
7#define UPS_UTILITY 1 /* supports utility line */ 8 UPS_NONE = 0, /* no supported options */
8#define UPS_BATTPCT 2 /* supports percent battery remaining */ 9 UPS_UTILITY = 1, /* supports utility line */
9#define UPS_STATUS 4 /* supports UPS status */ 10 UPS_BATTPCT = 2, /* supports percent battery remaining */
10#define UPS_TEMP 8 /* supports UPS temperature */ 11 UPS_STATUS = 4, /* supports UPS status */
11#define UPS_LOADPCT 16 /* supports load percent */ 12 UPS_TEMP = 8, /* supports UPS temperature */
12#define UPS_REALPOWER 32 /* supports real power */ 13 UPS_LOADPCT = 16, /* supports load percent */
13 14 UPS_REALPOWER = 32, /* supports real power */
14#define UPSSTATUS_NONE 0 15} ups_test_type;
15#define UPSSTATUS_OFF 1 16
16#define UPSSTATUS_OL 2 17typedef enum {
17#define UPSSTATUS_OB 4 18 UPSSTATUS_NONE = 0,
18#define UPSSTATUS_LB 8 19 UPSSTATUS_OFF = 1,
19#define UPSSTATUS_CAL 16 20 UPSSTATUS_OL = 2,
20#define UPSSTATUS_RB 32 /*Replace Battery */ 21 UPSSTATUS_OB = 4,
21#define UPSSTATUS_BYPASS 64 22 UPSSTATUS_LB = 8,
22#define UPSSTATUS_OVER 128 23 UPSSTATUS_CAL = 16,
23#define UPSSTATUS_TRIM 256 24 UPSSTATUS_RB = 32, /*Replace Battery */
24#define UPSSTATUS_BOOST 512 25 UPSSTATUS_BYPASS = 64,
25#define UPSSTATUS_CHRG 1024 26 UPSSTATUS_OVER = 128,
26#define UPSSTATUS_DISCHRG 2048 27 UPSSTATUS_TRIM = 256,
27#define UPSSTATUS_UNKNOWN 4096 28 UPSSTATUS_BOOST = 512,
28#define UPSSTATUS_ALARM 8192 29 UPSSTATUS_CHRG = 1024,
30 UPSSTATUS_DISCHRG = 2048,
31 UPSSTATUS_UNKNOWN = 4096,
32 UPSSTATUS_ALARM = 8192,
33} ups_status_type;
29 34
30enum { 35enum {
31 PORT = 3493 36 PORT = 3493
@@ -35,20 +40,28 @@ typedef struct ups_config {
35 unsigned int server_port; 40 unsigned int server_port;
36 char *server_address; 41 char *server_address;
37 char *ups_name; 42 char *ups_name;
38 double warning_value; 43
39 double critical_value; 44 mp_thresholds utility_thresholds;
40 bool check_warn; 45 mp_thresholds battery_thresholds;
41 bool check_crit; 46 mp_thresholds load_thresholds;
42 int check_variable; 47 mp_thresholds real_power_thresholds;
48 mp_thresholds temperature_thresholds;
49
43 bool temp_output_c; 50 bool temp_output_c;
44} check_ups_config; 51} check_ups_config;
45 52
46check_ups_config check_ups_config_init(void) { 53check_ups_config check_ups_config_init(void) {
47 check_ups_config tmp = {0}; 54 check_ups_config tmp = {
48 tmp.server_port = PORT; 55 .server_port = PORT,
49 tmp.server_address = NULL; 56 .server_address = NULL,
50 tmp.ups_name = NULL; 57 .ups_name = NULL,
51 tmp.check_variable = UPS_NONE; 58
59 .utility_thresholds = mp_thresholds_init(),
60 .battery_thresholds = mp_thresholds_init(),
61 .load_thresholds = mp_thresholds_init(),
62 .real_power_thresholds = mp_thresholds_init(),
63 .temperature_thresholds = mp_thresholds_init(),
64 };
52 65
53 return tmp; 66 return tmp;
54} 67}