diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-02-18 21:58:34 +0100 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-02-18 21:58:34 +0100 |
| commit | 0645c9fc2c7f801ba3c7d68a17c137a63ada299f (patch) | |
| tree | ce222906f546f03301defba9ce81ba57591a8eb3 /lib/utils_base.h | |
| parent | 39680498ee0987a5e0eb203a2c0539aa1fa94d39 (diff) | |
| download | monitoring-plugins-0645c9fc2c7f801ba3c7d68a17c137a63ada299f.tar.gz | |
Implement new output functionality
Diffstat (limited to 'lib/utils_base.h')
| -rw-r--r-- | lib/utils_base.h | 26 |
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 | ||
| 22 | typedef 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 | |||
| 31 | typedef 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 | ||
| 38 | typedef struct state_data_struct { | 31 | typedef struct state_data_struct { |
| @@ -61,6 +54,7 @@ int _set_thresholds(thresholds **, char *, char *); | |||
| 61 | void set_thresholds(thresholds **, char *, char *); | 54 | void set_thresholds(thresholds **, char *, char *); |
| 62 | void print_thresholds(const char *, thresholds *); | 55 | void print_thresholds(const char *, thresholds *); |
| 63 | bool check_range(double, range *); | 56 | bool check_range(double, range *); |
| 57 | bool mp_check_range(mp_perfdata_value, mp_range); | ||
| 64 | int get_status(double, thresholds *); | 58 | int 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); | |||
| 107 | int mp_translate_state(char *); | 101 | int mp_translate_state(char *); |
| 108 | 102 | ||
| 109 | void np_enable_state(char *, int); | 103 | void np_enable_state(char *, int); |
| 110 | state_data *np_state_read(); | 104 | state_data *np_state_read(void); |
| 111 | void np_state_write_string(time_t, char *); | 105 | void np_state_write_string(time_t, char *); |
| 112 | 106 | ||
| 113 | void np_init(char *, int argc, char **argv); | 107 | void np_init(char *, int argc, char **argv); |
| 114 | void np_set_args(int argc, char **argv); | 108 | void np_set_args(int argc, char **argv); |
| 115 | void np_cleanup(); | 109 | void np_cleanup(void); |
| 116 | const char *state_text(int); | 110 | const char *state_text(int); |
| 117 | 111 | ||
| 118 | #endif /* _UTILS_BASE_ */ | 112 | #endif /* _UTILS_BASE_ */ |
