diff --git a/Scripts/check-drives.ps1 b/Scripts/check-drives.ps1 index 1be53043..dbfb6abb 100755 --- a/Scripts/check-drives.ps1 +++ b/Scripts/check-drives.ps1 @@ -45,7 +45,7 @@ try { if ($total -eq 0) { Write-Host "✅ Drive $name is empty" } elseif ($free -eq 0) { - Write-Host "⚠️ Drive $name with $(Bytes2String $total) is 100% full" + Write-Host "⚠️ Drive $name with $(Bytes2String $total) is full" } elseif ($free -lt $minLevel) { Write-Host "⚠️ Drive $name with $(Bytes2String $total) is nearly full, $(Bytes2String $free) free" } else { diff --git a/Scripts/check-swap-space.ps1 b/Scripts/check-swap-space.ps1 index b49fbe4b..cf1be703 100755 --- a/Scripts/check-swap-space.ps1 +++ b/Scripts/check-swap-space.ps1 @@ -3,18 +3,18 @@ Checks the swap space status .DESCRIPTION This PowerShell script queries the status of the swap space and prints it. -.PARAMETER MinLevel - Specifies the minimum level (10 GB by default) +.PARAMETER minLevel + Specifies the minimum level in GB (10 GB by default) .EXAMPLE PS> ./check-swap-space.ps1 - ✅ 1GB Swap space at 42%, 748MB free + ✅ Swap space at 42% of 1GB, 748MB free .LINK https://github.com/fleschutz/PowerShell .NOTES Author: Markus Fleschutz | License: CC0 #> -param([int]$MinLevel = 10) # minimum level in GB +param([int]$minLevel = 10) function MB2String { param([int64]$Bytes) if ($Bytes -lt 1000) { return "$($Bytes)MB" } @@ -47,17 +47,13 @@ try { Write-Output "⚠️ No swap space configured" } elseif ($Free -eq 0) { Write-Output "⚠️ $(MB2String $Total) Swap space is full" - } elseif ($Free -lt $MinLevel) { + } elseif ($Free -lt $minLevel) { Write-Output "⚠️ $(MB2String $Total) Swap space is nearly full, only $(MB2String $Free) free" } elseif ($Used -eq 0) { Write-Output "✅ $(MB2String $Total) Swap space reserved" } else { [int]$Percent = ($Used * 100) / $Total - if ($Percent -ge 90) { - Write-Output "✅ $(MB2String $Total) Swap space is $Percent% full, only $(MB2String $Free) free" - } else { - Write-Output "✅ $(MB2String $Total) Swap space at $Percent%, $(MB2String $Free) free" - } + Write-Output "✅ Swap space at $Percent% of $(MB2String $Total), $(MB2String $Free) free" } exit 0 # success } catch {