mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Merge pull request #260 from Icinga:fix/numeric_conversion_for_comparison
Fix: Numeric converison to comparing thresholds is incorrect Fixes values to be transformed properly to `decimal` to compare them against thresholds provided
This commit is contained in:
commit
0a28e25ab0
2 changed files with 3 additions and 1 deletions
|
|
@ -170,7 +170,7 @@ function Convert-IcingaPluginThresholds()
|
|||
|
||||
if ([string]::IsNullOrEmpty($Value) -eq $FALSE -And $Value.Contains(':') -eq $FALSE) {
|
||||
if ((Test-Numeric $Value)) {
|
||||
$RetValue.Value = $Value;
|
||||
$RetValue.Value = [decimal]$Value;
|
||||
return $RetValue;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,9 +255,11 @@ function Compare-IcingaPluginThresholds()
|
|||
|
||||
if ((Test-Numeric ($rangeMin.Replace('@', '').Replace('~', '')))) {
|
||||
$IcingaThresholds.MinRangeValue = [decimal]($rangeMin.Replace('@', '').Replace('~', ''));
|
||||
[decimal]$rangeMin = [decimal]$rangeMin;
|
||||
}
|
||||
if ((Test-Numeric $rangeMax)) {
|
||||
$IcingaThresholds.MaxRangeValue = [decimal]$rangeMax;
|
||||
[decimal]$rangeMax = [decimal]$rangeMax;
|
||||
}
|
||||
|
||||
if ($IsNegating -eq $FALSE -And (Test-Numeric $rangeMin) -And (Test-Numeric $rangeMax)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue