summaryrefslogtreecommitdiffstats
path: root/lib/utils_base.h
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-02-18 21:58:34 +0100
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-02-18 21:58:34 +0100
commit0645c9fc2c7f801ba3c7d68a17c137a63ada299f (patch)
treece222906f546f03301defba9ce81ba57591a8eb3 /lib/utils_base.h
parent39680498ee0987a5e0eb203a2c0539aa1fa94d39 (diff)
downloadmonitoring-plugins-0645c9fc2c7f801ba3c7d68a17c137a63ada299f.tar.gz
Implement new output functionality
Diffstat (limited to 'lib/utils_base.h')
-rw-r--r--lib/utils_base.h26
1 files changed, 10 insertions, 16 deletions
diff --git a/lib/utils_base.h b/lib/utils_base.h
index a209cb6d..123066f8 100644
--- a/lib/utils_base.h
+++ b/lib/utils_base.h
@@ -2,6 +2,13 @@
2#define _UTILS_BASE_ 2#define _UTILS_BASE_
3/* Header file for Monitoring Plugins utils_base.c */ 3/* Header file for Monitoring Plugins utils_base.c */
4 4
5#include "../config.h"
6#include <time.h>
7
8#include "./perfdata.h"
9#include "./thresholds.h"
10
11
5#ifndef USE_OPENSSL 12#ifndef USE_OPENSSL
6# include "sha256.h" 13# include "sha256.h"
7#endif 14#endif
@@ -19,20 +26,6 @@
19#define OUTSIDE 0 26#define OUTSIDE 0
20#define INSIDE 1 27#define INSIDE 1
21 28
22typedef struct range_struct {
23 double start;
24 bool start_infinity;
25 double end;
26 int end_infinity;
27 int alert_on; /* OUTSIDE (default) or INSIDE */
28 char *text; /* original unparsed text input */
29} range;
30
31typedef struct thresholds_struct {
32 range *warning;
33 range *critical;
34} thresholds;
35
36#define NP_STATE_FORMAT_VERSION 1 29#define NP_STATE_FORMAT_VERSION 1
37 30
38typedef struct state_data_struct { 31typedef struct state_data_struct {
@@ -61,6 +54,7 @@ int _set_thresholds(thresholds **, char *, char *);
61void set_thresholds(thresholds **, char *, char *); 54void set_thresholds(thresholds **, char *, char *);
62void print_thresholds(const char *, thresholds *); 55void print_thresholds(const char *, thresholds *);
63bool check_range(double, range *); 56bool check_range(double, range *);
57bool mp_check_range(mp_perfdata_value, mp_range);
64int get_status(double, thresholds *); 58int get_status(double, thresholds *);
65 59
66/* Handle timeouts */ 60/* Handle timeouts */
@@ -107,12 +101,12 @@ char *np_extract_value(const char *, const char *, char);
107int mp_translate_state(char *); 101int mp_translate_state(char *);
108 102
109void np_enable_state(char *, int); 103void np_enable_state(char *, int);
110state_data *np_state_read(); 104state_data *np_state_read(void);
111void np_state_write_string(time_t, char *); 105void np_state_write_string(time_t, char *);
112 106
113void np_init(char *, int argc, char **argv); 107void np_init(char *, int argc, char **argv);
114void np_set_args(int argc, char **argv); 108void np_set_args(int argc, char **argv);
115void np_cleanup(); 109void np_cleanup(void);
116const char *state_text(int); 110const char *state_text(int);
117 111
118#endif /* _UTILS_BASE_ */ 112#endif /* _UTILS_BASE_ */