mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
Ensure numbers are printed as numeric with .
This commit is contained in:
parent
955c2b31f5
commit
e840d81148
2 changed files with 9 additions and 9 deletions
|
|
@ -19,24 +19,24 @@ function Convert-IcingaPluginValueToString()
|
|||
}
|
||||
|
||||
if ($Unit -eq '%' -Or [string]::IsNullOrEmpty($Unit)) {
|
||||
return ([string]::Format('{0}{1}', $AdjustedValue, $Unit));
|
||||
return ([string]::Format('{0}{1}', ([string]$AdjustedValue).Replace(',', '.'), $Unit));
|
||||
}
|
||||
|
||||
switch ($OriginalUnit) {
|
||||
{ ($_ -eq "Kbit") -or ($_ -eq "Mbit") -or ($_ -eq "Gbit") -or ($_ -eq "Tbit") -or ($_ -eq "Pbit") -or ($_ -eq "Ebit") -or ($_ -eq "Zbit") -or ($_ -eq "Ybit") } {
|
||||
$TransferSpeed = Get-IcingaNetworkInterfaceUnits -Value $Value;
|
||||
return ([string]::Format('{0}{1}', $TransferSpeed.LinkSpeed, $TransferSpeed.Unit));
|
||||
return ([string]::Format('{0}{1}', $TransferSpeed.LinkSpeed, $TransferSpeed.Unit)).Replace(',', '.');
|
||||
};
|
||||
{ ($_ -eq "B") -or ($_ -eq "KiB") -or ($_ -eq "MiB") -or ($_ -eq "GiB") -or ($_ -eq "TiB") -or ($_ -eq "PiB") -or ($_ -eq "EiB") -or ($_ -eq "ZiB") -or ($_ -eq "YiB") } {
|
||||
return (ConvertTo-BytesNextUnit -Value $Value -Unit $Unit -Units @('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'));
|
||||
return (ConvertTo-BytesNextUnit -Value $Value -Unit $Unit -Units @('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')).Replace(',', '.');
|
||||
};
|
||||
{ ($_ -eq "KB") -or ($_ -eq "MB") -or ($_ -eq "GB") -or ($_ -eq "TB") -or ($_ -eq "PB") -or ($_ -eq "EB") -or ($_ -eq "ZB") -or ($_ -eq "YB") } {
|
||||
return (ConvertTo-BytesNextUnit -Value $Value -Unit $Unit -Units @('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'));
|
||||
return (ConvertTo-BytesNextUnit -Value $Value -Unit $Unit -Units @('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB')).Replace(',', '.');
|
||||
};
|
||||
's' {
|
||||
return (ConvertFrom-TimeSpan -Seconds $AdjustedValue)
|
||||
return (ConvertFrom-TimeSpan -Seconds $AdjustedValue).Replace(',', '.')
|
||||
};
|
||||
}
|
||||
|
||||
return ([string]::Format('{0}{1}', $AdjustedValue, $Unit));
|
||||
return ([string]::Format('{0}{1}', ([string]$AdjustedValue).Replace(',', '.'), $Unit));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ function Compare-IcingaPluginThresholds()
|
|||
|
||||
if ($UseDynamicPercentage -And $Unit -ne '%') {
|
||||
$IcingaThresholds.IcingaThreshold = $IcingaThresholds.PercentValue;
|
||||
$PluginCurrentValue = [string]::Format('{0}% ({1})', ([math]::Round($IcingaThresholds.Value, 2)), (Convert-IcingaPluginValueToString -Unit $Unit -Value $IcingaThresholds.RawValue -OriginalUnit $IcingaThresholds.OriginalUnit));
|
||||
$PluginCurrentValue = [string]::Format('{0}% ({1})', ([string]([math]::Round($IcingaThresholds.Value, 2))).Replace(',', '.'), (Convert-IcingaPluginValueToString -Unit $Unit -Value $IcingaThresholds.RawValue -OriginalUnit $IcingaThresholds.OriginalUnit));
|
||||
$PluginThresholdValue = $IcingaThresholds.RawThreshold;
|
||||
}
|
||||
|
||||
|
|
@ -411,11 +411,11 @@ function Compare-IcingaPluginThresholds()
|
|||
|
||||
if ([string]::IsNullOrEmpty($IcingaThresholds.Message) -eq $FALSE) {
|
||||
$PluginOutputMessage.Append(' ') | Out-Null;
|
||||
$PluginOutputMessage.Append($IcingaThresholds.Message) | Out-Null;
|
||||
$PluginOutputMessage.Append($IcingaThresholds.Message.Replace(',', '.')) | Out-Null;
|
||||
|
||||
if ([string]::IsNullOrEmpty($PluginThresholdValue) -eq $FALSE) {
|
||||
$PluginOutputMessage.Append(' ') | Out-Null;
|
||||
$PluginOutputMessage.Append($PluginThresholdValue) | Out-Null;
|
||||
$PluginOutputMessage.Append(([string]$PluginThresholdValue).Replace(',', '.')) | Out-Null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue