Fixes numeric converison to comparing thresholds

This commit is contained in:
Lord Hepipud 2021-05-29 10:55:56 +02:00
parent 53f75e8252
commit f6480e37c6
2 changed files with 3 additions and 1 deletions

View file

@ -170,7 +170,7 @@ function Convert-IcingaPluginThresholds()
if ([string]::IsNullOrEmpty($Value) -eq $FALSE -And $Value.Contains(':') -eq $FALSE) { if ([string]::IsNullOrEmpty($Value) -eq $FALSE -And $Value.Contains(':') -eq $FALSE) {
if ((Test-Numeric $Value)) { if ((Test-Numeric $Value)) {
$RetValue.Value = $Value; $RetValue.Value = [decimal]$Value;
return $RetValue; return $RetValue;
} }
} }

View file

@ -255,9 +255,11 @@ function Compare-IcingaPluginThresholds()
if ((Test-Numeric ($rangeMin.Replace('@', '').Replace('~', '')))) { if ((Test-Numeric ($rangeMin.Replace('@', '').Replace('~', '')))) {
$IcingaThresholds.MinRangeValue = [decimal]($rangeMin.Replace('@', '').Replace('~', '')); $IcingaThresholds.MinRangeValue = [decimal]($rangeMin.Replace('@', '').Replace('~', ''));
[decimal]$rangeMin = [decimal]$rangeMin;
} }
if ((Test-Numeric $rangeMax)) { if ((Test-Numeric $rangeMax)) {
$IcingaThresholds.MaxRangeValue = [decimal]$rangeMax; $IcingaThresholds.MaxRangeValue = [decimal]$rangeMax;
[decimal]$rangeMax = [decimal]$rangeMax;
} }
if ($IsNegating -eq $FALSE -And (Test-Numeric $rangeMin) -And (Test-Numeric $rangeMax)) { if ($IsNegating -eq $FALSE -And (Test-Numeric $rangeMin) -And (Test-Numeric $rangeMax)) {