diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-12 23:37:36 +0100 |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-12 23:37:36 +0100 |
commit | 4a0e309f9f5a85af6087e3eb7034a98dd410c6f7 (patch) | |
tree | 088d5ef0c241701ff440d0a8b7da00ddfa5b2330 | |
parent | 1f7e8b57e2105e68ba97c9a5c9fbafa6b692a804 (diff) | |
download | monitoring-plugins-4a0e309f.tar.gz |
Fail correctly with missing thresholds
-rw-r--r-- | plugins/check_users.c | 12 |
1 files 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) { | |||
215 | if (warning_range) { | 215 | if (warning_range) { |
216 | tmp = mp_parse_range_string(warning_range); | 216 | tmp = mp_parse_range_string(warning_range); |
217 | } else { | 217 | } else { |
218 | tmp = mp_parse_range_string(argv[option_char++]); | 218 | printf("Warning threshold missing\n"); |
219 | } | 219 | print_usage(); |
220 | exit(STATE_UNKNOWN); | ||
221 | } | ||
222 | |||
220 | if (tmp.error == MP_PARSING_SUCCES) { | 223 | if (tmp.error == MP_PARSING_SUCCES) { |
221 | result.config.thresholds.warning = tmp.range; | 224 | result.config.thresholds.warning = tmp.range; |
222 | result.config.thresholds.warning_is_set = true; | 225 | result.config.thresholds.warning_is_set = true; |
@@ -228,8 +231,11 @@ check_users_config_wrapper process_arguments(int argc, char **argv) { | |||
228 | if (critical_range) { | 231 | if (critical_range) { |
229 | tmp = mp_parse_range_string(critical_range); | 232 | tmp = mp_parse_range_string(critical_range); |
230 | } else { | 233 | } else { |
231 | tmp = mp_parse_range_string(argv[option_char++]); | 234 | printf("Critical threshold missing\n"); |
235 | print_usage(); | ||
236 | exit(STATE_UNKNOWN); | ||
232 | } | 237 | } |
238 | |||
233 | if (tmp.error == MP_PARSING_SUCCES) { | 239 | if (tmp.error == MP_PARSING_SUCCES) { |
234 | result.config.thresholds.critical = tmp.range; | 240 | result.config.thresholds.critical = tmp.range; |
235 | result.config.thresholds.critical_is_set = true; | 241 | result.config.thresholds.critical_is_set = true; |