mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Fixes PetaByte unit short name
This commit is contained in:
parent
ff06ea5f13
commit
499af2b92e
3 changed files with 8 additions and 8 deletions
|
|
@ -21,7 +21,7 @@ function Convert-Bytes()
|
|||
{ 'MB' -contains $_} { $FinalValue = ConvertTo-MegaByte $CurrentValue -Unit B; $boolOption = $true;}
|
||||
{ 'GB' -contains $_} { $FinalValue = ConvertTo-GigaByte $CurrentValue -Unit B; $boolOption = $true;}
|
||||
{ 'TB' -contains $_} { $FinalValue = ConvertTo-TeraByte $CurrentValue -Unit B; $boolOption = $true;}
|
||||
{ 'PT' -contains $_} { $FinalValue = ConvertTo-PetaByte $CurrentValue -Unit B; $boolOption = $true;}
|
||||
{ 'PB' -contains $_} { $FinalValue = ConvertTo-PetaByte $CurrentValue -Unit B; $boolOption = $true;}
|
||||
{ 'KiB' -contains $_} { $FinalValue = ConvertTo-KiBByte $CurrentValue -Unit B; $boolOption = $true;}
|
||||
{ 'MiB' -contains $_} { $FinalValue = ConvertTo-MiBByte $CurrentValue -Unit B; $boolOption = $true;}
|
||||
{ 'GiB' -contains $_} { $FinalValue = ConvertTo-GiBByte $CurrentValue -Unit B; $boolOption = $true;}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ function ConvertTo-ByteSI()
|
|||
{ 'MB', 'MegaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 6)); $boolOption = $true; }
|
||||
{ 'GB', 'GigaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 9)); $boolOption = $true; }
|
||||
{ 'TB', 'TeraByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 12)); $boolOption = $true; }
|
||||
{ 'PT', 'PetaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 15)); $boolOption = $true; }
|
||||
{ 'PB', 'PetaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 15)); $boolOption = $true; }
|
||||
default {
|
||||
if (-Not $boolOption) {
|
||||
Exit-IcingaThrowException -ExceptionType 'Input' -ExceptionThrown $IcingaExceptions.Inputs.ConversionUnitMissing -Force;
|
||||
|
|
@ -67,7 +67,7 @@ function ConvertTo-KiloByte()
|
|||
{ 'MB', 'MegaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 3)); $boolOption = $true; }
|
||||
{ 'GB', 'GigaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 6)); $boolOption = $true; }
|
||||
{ 'TB', 'TeraByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 9)); $boolOption = $true; }
|
||||
{ 'PT', 'PetaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 12)); $boolOption = $true; }
|
||||
{ 'PB', 'PetaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 12)); $boolOption = $true; }
|
||||
default {
|
||||
if (-Not $boolOption) {
|
||||
Exit-IcingaThrowException -ExceptionType 'Input' -ExceptionThrown $IcingaExceptions.Inputs.ConversionUnitMissing -Force;
|
||||
|
|
@ -107,7 +107,7 @@ function ConvertTo-MegaByte()
|
|||
{ 'MB', 'MegaByte' -contains $_ } { $result = $Value; $boolOption = $true; }
|
||||
{ 'GB', 'GigaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 3)); $boolOption = $true; }
|
||||
{ 'TB', 'TeraByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 6)); $boolOption = $true; }
|
||||
{ 'PT', 'PetaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 9)); $boolOption = $true; }
|
||||
{ 'PB', 'PetaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 9)); $boolOption = $true; }
|
||||
default {
|
||||
if (-Not $boolOption) {
|
||||
Exit-IcingaThrowException -ExceptionType 'Input' -ExceptionThrown $IcingaExceptions.Inputs.ConversionUnitMissing -Force;
|
||||
|
|
@ -147,7 +147,7 @@ function ConvertTo-GigaByte()
|
|||
{ 'MB', 'MegaByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 3)); $boolOption = $true; }
|
||||
{ 'GB', 'GigaByte' -contains $_ } { $result = $Value; $boolOption = $true; }
|
||||
{ 'TB', 'TeraByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 3)); $boolOption = $true; }
|
||||
{ 'PT', 'PetaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 6)); $boolOption = $true; }
|
||||
{ 'PB', 'PetaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 6)); $boolOption = $true; }
|
||||
default {
|
||||
if (-Not $boolOption) {
|
||||
Exit-IcingaThrowException -ExceptionType 'Input' -ExceptionThrown $IcingaExceptions.Inputs.ConversionUnitMissing -Force;
|
||||
|
|
@ -187,7 +187,7 @@ function ConvertTo-TeraByte()
|
|||
{ 'MB', 'MegaByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 6)); $boolOption = $true; }
|
||||
{ 'GB', 'GigaByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 3)); $boolOption = $true; }
|
||||
{ 'TB', 'TeraByte' -contains $_ } { $result = $Value; $boolOption = $true; }
|
||||
{ 'PT', 'PetaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 3)); $boolOption = $true; }
|
||||
{ 'PB', 'PetaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 3)); $boolOption = $true; }
|
||||
default {
|
||||
if (-Not $boolOption) {
|
||||
Exit-IcingaThrowException -ExceptionType 'Input' -ExceptionThrown $IcingaExceptions.Inputs.ConversionUnitMissing -Force;
|
||||
|
|
@ -227,7 +227,7 @@ function ConvertTo-PetaByte()
|
|||
{ 'MB', 'MegaByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 9)); $boolOption = $true; }
|
||||
{ 'GB', 'GigaByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 6)); $boolOption = $true; }
|
||||
{ 'TB', 'TeraByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 3)); $boolOption = $true; }
|
||||
{ 'PT', 'PetaByte' -contains $_ } { $result = $Value; $boolOption = $true; }
|
||||
{ 'PB', 'PetaByte' -contains $_ } { $result = $Value; $boolOption = $true; }
|
||||
default {
|
||||
if (-Not $boolOption) {
|
||||
Exit-IcingaThrowException -ExceptionType 'Input' -ExceptionThrown $IcingaExceptions.Inputs.ConversionUnitMissing -Force;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
PerformanceCounter = 'A plugin failed to fetch Performance Counter information. Please ensure the counter is written properly and available on your system.';
|
||||
EventLogLogName = 'Failed to fetch EventLog information. Please specify a valid LogName.';
|
||||
EventLog = 'Failed to fetch EventLog information. Please check your inputs for EntryTypes and other categories and try again.';
|
||||
ConversionUnitMissing = 'Unable to parse input value. You have to add an unit to your input value. Example: "10GB". Allowed units are: "B, KB, MB, GB, TB, PT, KiB, MiB, GiB, TiB, PiB".';
|
||||
ConversionUnitMissing = 'Unable to parse input value. You have to add an unit to your input value. Example: "10GB". Allowed units are: "B, KB, MB, GB, TB, PB, KiB, MiB, GiB, TiB, PiB".';
|
||||
};
|
||||
|
||||
<#
|
||||
|
|
|
|||
Loading…
Reference in a new issue