diff options
Diffstat (limited to 'lib/utils_base.c')
-rw-r--r-- | lib/utils_base.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/utils_base.c b/lib/utils_base.c index c49a473f..60103614 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> |
@@ -256,21 +257,21 @@ bool check_range(double value, range *my_range) { | |||
256 | yes = false; | 257 | yes = false; |
257 | } | 258 | } |
258 | 259 | ||
259 | if (my_range->end_infinity == false && my_range->start_infinity == false) { | 260 | if (!my_range->end_infinity&& !my_range->start_infinity) { |
260 | if ((my_range->start <= value) && (value <= my_range->end)) { | 261 | if ((my_range->start <= value) && (value <= my_range->end)) { |
261 | return no; | 262 | return no; |
262 | } | 263 | } |
263 | return yes; | 264 | return yes; |
264 | } | 265 | } |
265 | 266 | ||
266 | if (my_range->start_infinity == false && my_range->end_infinity == true) { | 267 | if (!my_range->start_infinity && my_range->end_infinity) { |
267 | if (my_range->start <= value) { | 268 | if (my_range->start <= value) { |
268 | return no; | 269 | return no; |
269 | } | 270 | } |
270 | return yes; | 271 | return yes; |
271 | } | 272 | } |
272 | 273 | ||
273 | if (my_range->start_infinity == true && my_range->end_infinity == false) { | 274 | if (my_range->start_infinity && !my_range->end_infinity ) { |
274 | if (value <= my_range->end) { | 275 | if (value <= my_range->end) { |
275 | return no; | 276 | return no; |
276 | } | 277 | } |
@@ -280,14 +281,14 @@ bool check_range(double value, range *my_range) { | |||
280 | } | 281 | } |
281 | 282 | ||
282 | /* Returns status */ | 283 | /* Returns status */ |
283 | int get_status(double value, thresholds *my_thresholds) { | 284 | mp_state_enum get_status(double value, thresholds *my_thresholds) { |
284 | if (my_thresholds->critical != NULL) { | 285 | if (my_thresholds->critical != NULL) { |
285 | if (check_range(value, my_thresholds->critical) == true) { | 286 | if (check_range(value, my_thresholds->critical)) { |
286 | return STATE_CRITICAL; | 287 | return STATE_CRITICAL; |
287 | } | 288 | } |
288 | } | 289 | } |
289 | if (my_thresholds->warning != NULL) { | 290 | if (my_thresholds->warning != NULL) { |
290 | if (check_range(value, my_thresholds->warning) == true) { | 291 | if (check_range(value, my_thresholds->warning)) { |
291 | return STATE_WARNING; | 292 | return STATE_WARNING; |
292 | } | 293 | } |
293 | } | 294 | } |
@@ -395,7 +396,7 @@ char *np_extract_value(const char *varlist, const char *name, char sep) { | |||
395 | return value; | 396 | return value; |
396 | } | 397 | } |
397 | 398 | ||
398 | const char *state_text(int result) { | 399 | const char *state_text(mp_state_enum result) { |
399 | switch (result) { | 400 | switch (result) { |
400 | case STATE_OK: | 401 | case STATE_OK: |
401 | return "OK"; | 402 | return "OK"; |