diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-10-18 12:03:10 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-10-18 12:03:10 +0000 |
commit | c56c42b9c999742ff3cfebf1cadc8c93ad68048c (patch) | |
tree | 78ab319e6f5bf4062af3022c6e1c0da2602a6790 /lib/utils_base.c | |
parent | d00a65f8172ea55b6b4938c65ae0568dbd03b9c0 (diff) | |
download | monitoring-plugins-c56c42b9c999742ff3cfebf1cadc8c93ad68048c.tar.gz |
Cater for different errors when setting thresholds
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1496 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib/utils_base.c')
-rw-r--r-- | lib/utils_base.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/utils_base.c b/lib/utils_base.c index 3dae32fb..18fb3f25 100644 --- a/lib/utils_base.c +++ b/lib/utils_base.c @@ -96,12 +96,12 @@ _set_thresholds(thresholds **my_thresholds, char *warn_string, char *critical_st if (warn_string != NULL) { if ((temp_thresholds->warning = parse_range_string(warn_string)) == NULL) { - return 1; + return NP_RANGE_UNPARSEABLE; } } if (critical_string != NULL) { if ((temp_thresholds->critical = parse_range_string(critical_string)) == NULL) { - return 1; + return NP_RANGE_UNPARSEABLE; } } @@ -117,10 +117,14 @@ _set_thresholds(thresholds **my_thresholds, char *warn_string, char *critical_st void set_thresholds(thresholds **my_thresholds, char *warn_string, char *critical_string) { - if (_set_thresholds(my_thresholds, warn_string, critical_string) == 0) { + switch (_set_thresholds(my_thresholds, warn_string, critical_string)) { + case 0: return; - } else { + case NP_RANGE_UNPARSEABLE: die(STATE_UNKNOWN, _("Range format incorrect")); + case NP_WARN_WITHIN_CRIT: + die(STATE_UNKNOWN, _("Warning level is a subset of critical and will not be alerted")); + break; } } |