diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/utils_base.c | 9 | ||||
-rw-r--r-- | lib/utils_base.h | 5 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/utils_base.c b/lib/utils_base.c index 29b393d0..e95eeaf0 100644 --- a/lib/utils_base.c +++ b/lib/utils_base.c | |||
@@ -25,6 +25,7 @@ | |||
25 | *****************************************************************************/ | 25 | *****************************************************************************/ |
26 | 26 | ||
27 | #include "../plugins/common.h" | 27 | #include "../plugins/common.h" |
28 | #include "states.h" | ||
28 | #include <stdarg.h> | 29 | #include <stdarg.h> |
29 | #include "utils_base.h" | 30 | #include "utils_base.h" |
30 | #include <ctype.h> | 31 | #include <ctype.h> |
@@ -253,7 +254,7 @@ bool check_range(double value, range *my_range) { | |||
253 | yes = false; | 254 | yes = false; |
254 | } | 255 | } |
255 | 256 | ||
256 | if (!my_range->end_infinity && !my_range->start_infinity) { | 257 | if (!my_range->end_infinity&& !my_range->start_infinity) { |
257 | if ((my_range->start <= value) && (value <= my_range->end)) { | 258 | if ((my_range->start <= value) && (value <= my_range->end)) { |
258 | return no; | 259 | return no; |
259 | } | 260 | } |
@@ -267,7 +268,7 @@ bool check_range(double value, range *my_range) { | |||
267 | return yes; | 268 | return yes; |
268 | } | 269 | } |
269 | 270 | ||
270 | if (my_range->start_infinity && !my_range->end_infinity) { | 271 | if (my_range->start_infinity && !my_range->end_infinity ) { |
271 | if (value <= my_range->end) { | 272 | if (value <= my_range->end) { |
272 | return no; | 273 | return no; |
273 | } | 274 | } |
@@ -277,7 +278,7 @@ bool check_range(double value, range *my_range) { | |||
277 | } | 278 | } |
278 | 279 | ||
279 | /* Returns status */ | 280 | /* Returns status */ |
280 | int get_status(double value, thresholds *my_thresholds) { | 281 | mp_state_enum get_status(double value, thresholds *my_thresholds) { |
281 | if (my_thresholds->critical != NULL) { | 282 | if (my_thresholds->critical != NULL) { |
282 | if (check_range(value, my_thresholds->critical)) { | 283 | if (check_range(value, my_thresholds->critical)) { |
283 | return STATE_CRITICAL; | 284 | return STATE_CRITICAL; |
@@ -393,7 +394,7 @@ char *np_extract_value(const char *varlist, const char *name, char sep) { | |||
393 | return value; | 394 | return value; |
394 | } | 395 | } |
395 | 396 | ||
396 | const char *state_text(int result) { | 397 | const char *state_text(mp_state_enum result) { |
397 | switch (result) { | 398 | switch (result) { |
398 | case STATE_OK: | 399 | case STATE_OK: |
399 | return "OK"; | 400 | return "OK"; |
diff --git a/lib/utils_base.h b/lib/utils_base.h index f1c99a54..f31299c4 100644 --- a/lib/utils_base.h +++ b/lib/utils_base.h | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include "./perfdata.h" | 8 | #include "./perfdata.h" |
9 | #include "./thresholds.h" | 9 | #include "./thresholds.h" |
10 | #include "states.h" | ||
10 | 11 | ||
11 | #ifndef USE_OPENSSL | 12 | #ifndef USE_OPENSSL |
12 | # include "sha256.h" | 13 | # include "sha256.h" |
@@ -37,7 +38,7 @@ void set_thresholds(thresholds **, char *, char *); | |||
37 | void print_thresholds(const char *, thresholds *); | 38 | void print_thresholds(const char *, thresholds *); |
38 | bool check_range(double, range *); | 39 | bool check_range(double, range *); |
39 | bool mp_check_range(mp_perfdata_value, mp_range); | 40 | bool mp_check_range(mp_perfdata_value, mp_range); |
40 | int get_status(double, thresholds *); | 41 | mp_state_enum get_status(double, thresholds *); |
41 | 42 | ||
42 | /* Handle timeouts */ | 43 | /* Handle timeouts */ |
43 | extern int timeout_state; | 44 | extern int timeout_state; |
@@ -85,6 +86,6 @@ int mp_translate_state(char *); | |||
85 | void np_init(char *, int argc, char **argv); | 86 | void np_init(char *, int argc, char **argv); |
86 | void np_set_args(int argc, char **argv); | 87 | void np_set_args(int argc, char **argv); |
87 | void np_cleanup(void); | 88 | void np_cleanup(void); |
88 | const char *state_text(int); | 89 | const char *state_text(mp_state_enum); |
89 | 90 | ||
90 | #endif /* _UTILS_BASE_ */ | 91 | #endif /* _UTILS_BASE_ */ |