mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
24 lines
537 B
PowerShell
24 lines
537 B
PowerShell
function Get-IcingaNetworkInterfaceUnits()
|
|
{
|
|
param (
|
|
[long]$Value
|
|
);
|
|
|
|
[hashtable]$InterfaceData = @{
|
|
'RawValue' = $Value;
|
|
'LinkSpeed' = 0;
|
|
'Unit' = 'Mbit'
|
|
};
|
|
|
|
[decimal]$result = ($Value / [Math]::Pow(10, 6));
|
|
|
|
if ($result -ge 1000) {
|
|
$InterfaceData.LinkSpeed = [decimal]($result / 1000);
|
|
$InterfaceData.Unit = 'Gbit';
|
|
} else {
|
|
$InterfaceData.LinkSpeed = $result;
|
|
$InterfaceData.Unit = 'Mbit';
|
|
}
|
|
|
|
return $InterfaceData;
|
|
}
|