From 0645c9fc2c7f801ba3c7d68a17c137a63ada299f Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Tue, 18 Feb 2025 21:58:34 +0100 Subject: Implement new output functionality --- lib/utils_base.h | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'lib/utils_base.h') 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 @@ #define _UTILS_BASE_ /* Header file for Monitoring Plugins utils_base.c */ +#include "../config.h" +#include + +#include "./perfdata.h" +#include "./thresholds.h" + + #ifndef USE_OPENSSL # include "sha256.h" #endif @@ -19,20 +26,6 @@ #define OUTSIDE 0 #define INSIDE 1 -typedef struct range_struct { - double start; - bool start_infinity; - double end; - int end_infinity; - int alert_on; /* OUTSIDE (default) or INSIDE */ - char *text; /* original unparsed text input */ -} range; - -typedef struct thresholds_struct { - range *warning; - range *critical; -} thresholds; - #define NP_STATE_FORMAT_VERSION 1 typedef struct state_data_struct { @@ -61,6 +54,7 @@ int _set_thresholds(thresholds **, char *, char *); void set_thresholds(thresholds **, char *, char *); void print_thresholds(const char *, thresholds *); bool check_range(double, range *); +bool mp_check_range(mp_perfdata_value, mp_range); int get_status(double, thresholds *); /* Handle timeouts */ @@ -107,12 +101,12 @@ char *np_extract_value(const char *, const char *, char); int mp_translate_state(char *); void np_enable_state(char *, int); -state_data *np_state_read(); +state_data *np_state_read(void); void np_state_write_string(time_t, char *); void np_init(char *, int argc, char **argv); void np_set_args(int argc, char **argv); -void np_cleanup(); +void np_cleanup(void); const char *state_text(int); #endif /* _UTILS_BASE_ */ -- cgit v1.2.3-74-g34f1