1313 PS>Invoke-IcingaCheckMemory -Verbosity 3 -Warning 60 -Critical 80
1414 [WARNING]: % Memory Check 78.74 is greater than 60
1515. EXAMPLE
16- PS> Invoke-IcingaCheckMemory -WarningPercent 0: 30 -CriticalPercent 0: 50
16+ PS> Invoke-IcingaCheckMemory -WarningPercent 30 -CriticalPercent 50
1717 [WARNING] Check package "Memory Usage" - [WARNING] Memory Percent Used
1818 \_ [WARNING] Memory Percent Used: Value "48.07%" is greater than threshold "30%"
1919 | 'memory_percent_used'=48.07%;0:30;0:50;0;100 'used_bytes'=3.85GB;;;0;8
5555function Invoke-IcingaCheckMemory ()
5656{
5757 param (
58- [string ]$Critical = $null ,
59- [string ]$Warning = $null ,
60- $CriticalPercent = $null ,
61- $WarningPercent = $null ,
58+ [string ]$Critical = $null ,
59+ [string ]$Warning = $null ,
60+ $CriticalPercent = $null ,
61+ $WarningPercent = $null ,
6262 [ValidateSet (0 , 1 , 2 , 3 )]
63- [int ]$Verbosity = 0 ,
63+ [int ]$Verbosity = 0 ,
6464 [switch ]$NoPerfData
6565 );
6666
@@ -69,23 +69,23 @@ function Invoke-IcingaCheckMemory()
6969
7070 # Auto-Detect?
7171 If (($MemoryData [' Memory Total Bytes' ] / [math ]::Pow(2 , 50 )) -ge 1 ) {
72- $CalcUnit = ' PiB' ;
73- $Unit = " PB" ;
72+ [ string ] $CalcUnit = ' PiB' ;
73+ [ string ] $Unit = " PB" ;
7474 } elseif (($MemoryData [' Memory Total Bytes' ] / [math ]::Pow(2 , 40 )) -ge 1 ) {
75- $CalcUnit = ' TiB' ;
76- $Unit = " TB" ;
75+ [ string ] $CalcUnit = ' TiB' ;
76+ [ string ] $Unit = " TB" ;
7777 } elseif (($MemoryData [' Memory Total Bytes' ] / [math ]::Pow(2 , 30 )) -ge 1 ) {
78- $CalcUnit = ' GiB' ;
79- $Unit = " GB" ;
78+ [ string ] $CalcUnit = ' GiB' ;
79+ [ string ] $Unit = " GB" ;
8080 } elseif (($MemoryData [' Memory Total Bytes' ] / [math ]::Pow(2 , 20 )) -ge 1 ) {
81- $CalcUnit = ' MiB' ;
82- $Unit = " MB" ;
81+ [ string ] $CalcUnit = ' MiB' ;
82+ [ string ] $Unit = " MB" ;
8383 } elseif (($MemoryData [' Memory Total Bytes' ] / [math ]::Pow(2 , 10 )) -ge 1 ) {
84- $CalcUnit = ' KiB' ;
85- $Unit = " KB" ;
84+ [ string ] $CalcUnit = ' KiB' ;
85+ [ string ] $Unit = " KB" ;
8686 } else {
87- $CalcUnit = ' B' ;
88- $Unit = " B" ;
87+ [ string ] $CalcUnit = ' B' ;
88+ [ string ] $Unit = " B" ;
8989 }
9090
9191 If ([string ]::IsNullOrEmpty($Critical ) -eq $FALSE ) {
0 commit comments