diff options
Diffstat (limited to 'lib/utils_base.h')
| -rw-r--r-- | lib/utils_base.h | 51 |
1 files changed, 12 insertions, 39 deletions
diff --git a/lib/utils_base.h b/lib/utils_base.h index a209cb6d..27884bf0 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 | #include "states.h" | ||
| 11 | |||
| 5 | #ifndef USE_OPENSSL | 12 | #ifndef USE_OPENSSL |
| 6 | # include "sha256.h" | 13 | # include "sha256.h" |
| 7 | #endif | 14 | #endif |
| @@ -19,39 +26,8 @@ | |||
| 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 | ||
| 37 | |||
| 38 | typedef struct state_data_struct { | ||
| 39 | time_t time; | ||
| 40 | void *data; | ||
| 41 | int length; /* Of binary data */ | ||
| 42 | } state_data; | ||
| 43 | |||
| 44 | typedef struct state_key_struct { | ||
| 45 | char *name; | ||
| 46 | char *plugin_name; | ||
| 47 | int data_version; | ||
| 48 | char *_filename; | ||
| 49 | state_data *state_data; | ||
| 50 | } state_key; | ||
| 51 | |||
| 52 | typedef struct np_struct { | 29 | typedef struct np_struct { |
| 53 | char *plugin_name; | 30 | char *plugin_name; |
| 54 | state_key *state; | ||
| 55 | int argc; | 31 | int argc; |
| 56 | char **argv; | 32 | char **argv; |
| 57 | } monitoring_plugin; | 33 | } monitoring_plugin; |
| @@ -61,10 +37,11 @@ int _set_thresholds(thresholds **, char *, char *); | |||
| 61 | void set_thresholds(thresholds **, char *, char *); | 37 | void set_thresholds(thresholds **, char *, char *); |
| 62 | void print_thresholds(const char *, thresholds *); | 38 | void print_thresholds(const char *, thresholds *); |
| 63 | bool check_range(double, range *); | 39 | bool check_range(double, range *); |
| 64 | int get_status(double, thresholds *); | 40 | bool mp_check_range(mp_perfdata_value, mp_range); |
| 41 | mp_state_enum get_status(double, thresholds *); | ||
| 65 | 42 | ||
| 66 | /* Handle timeouts */ | 43 | /* Handle timeouts */ |
| 67 | extern int timeout_state; | 44 | extern mp_state_enum timeout_state; |
| 68 | extern unsigned int timeout_interval; | 45 | extern unsigned int timeout_interval; |
| 69 | 46 | ||
| 70 | /* All possible characters in a threshold range */ | 47 | /* All possible characters in a threshold range */ |
| @@ -106,13 +83,9 @@ char *np_extract_value(const char *, const char *, char); | |||
| 106 | */ | 83 | */ |
| 107 | int mp_translate_state(char *); | 84 | int mp_translate_state(char *); |
| 108 | 85 | ||
| 109 | void np_enable_state(char *, int); | ||
| 110 | state_data *np_state_read(); | ||
| 111 | void np_state_write_string(time_t, char *); | ||
| 112 | |||
| 113 | void np_init(char *, int argc, char **argv); | 86 | void np_init(char *, int argc, char **argv); |
| 114 | void np_set_args(int argc, char **argv); | 87 | void np_set_args(int argc, char **argv); |
| 115 | void np_cleanup(); | 88 | void np_cleanup(void); |
| 116 | const char *state_text(int); | 89 | const char *state_text(mp_state_enum); |
| 117 | 90 | ||
| 118 | #endif /* _UTILS_BASE_ */ | 91 | #endif /* _UTILS_BASE_ */ |
