[monitoring-plugins] Fail correctly with missing thresholds

Lorenz Kästle git at monitoring-plugins.org
Mon Aug 11 23:30:12 CEST 2025


 Module: monitoring-plugins
 Branch: master
 Commit: 4a0e309f9f5a85af6087e3eb7034a98dd410c6f7
 Author: Lorenz Kästle <12514511+RincewindsHat at users.noreply.github.com>
   Date: Wed Mar 12 23:37:36 2025 +0100
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=4a0e309f

Fail correctly with missing thresholds

---

 plugins/check_users.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/plugins/check_users.c b/plugins/check_users.c
index b7b7bd24..cd3bd181 100644
--- a/plugins/check_users.c
+++ b/plugins/check_users.c
@@ -215,8 +215,11 @@ check_users_config_wrapper process_arguments(int argc, char **argv) {
 	if (warning_range) {
 		tmp = mp_parse_range_string(warning_range);
 	} else {
-		tmp = mp_parse_range_string(argv[option_char++]);
-	}
+		printf("Warning threshold missing\n");
+		print_usage();
+		exit(STATE_UNKNOWN);
+		}
+
 	if (tmp.error == MP_PARSING_SUCCES) {
 		result.config.thresholds.warning = tmp.range;
 		result.config.thresholds.warning_is_set = true;
@@ -228,8 +231,11 @@ check_users_config_wrapper process_arguments(int argc, char **argv) {
 	if (critical_range) {
 		tmp = mp_parse_range_string(critical_range);
 	} else {
-		tmp = mp_parse_range_string(argv[option_char++]);
+		printf("Critical threshold missing\n");
+		print_usage();
+		exit(STATE_UNKNOWN);
 	}
+
 	if (tmp.error == MP_PARSING_SUCCES) {
 		result.config.thresholds.critical = tmp.range;
 		result.config.thresholds.critical_is_set = true;



More information about the Commits mailing list