summaryrefslogtreecommitdiffstats
path: root/lib/utils_base.c
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-09-15 10:13:33 +0200
committerGitHub <noreply@github.com>2025-09-15 10:13:33 +0200
commita3cf9041af810770daf5d9b83f1906fa9bb0dd11 (patch)
tree9b9b45a6a611c4f37cf5dd447b37f74e48d56c14 /lib/utils_base.c
parentf69aba3129d672b88f5bae187fb971fc0ac228ed (diff)
parent5a2c1b2c3aeb99e7a703b0c5f6fe1a21d29b3be4 (diff)
downloadmonitoring-plugins-a3cf9041af810770daf5d9b83f1906fa9bb0dd11.tar.gz
Merge pull request #2085 from RincewindsHat/refactor/check_curl
Refactor/check curl and introduce new output formatting
Diffstat (limited to 'lib/utils_base.c')
-rw-r--r--lib/utils_base.c9
1 files changed, 5 insertions, 4 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 */
280int get_status(double value, thresholds *my_thresholds) { 281mp_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
396const char *state_text(int result) { 397const 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";