File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 Specifies the minimum level in MB (10 MB by default)
88. EXAMPLE
99 PS> ./check-swap-space.ps1
10- ✅ Swap space uses 21% of 1GB - 1005MB free
10+ ✅ Swap space uses 1GB ( 21%) of 5GB
1111. LINK
1212 https://github.com/fleschutz/PowerShell
1313. NOTES
@@ -48,14 +48,14 @@ try {
4848 if ($total -eq 0 ) {
4949 Write-Output " ⚠️ No swap space configured"
5050 } elseif ($free -eq 0 ) {
51- Write-Output " ⚠️ Swap space is full ( $ ( MB2String $total ) ) "
51+ Write-Output " ⚠️ Swap space with $ ( MB2String $total ) is FULL !!! "
5252 } elseif ($free -lt $minLevel ) {
53- Write-Output " ⚠️ Swap space has only $ ( MB2String $free ) of $ ( MB2String $total ) left"
53+ Write-Output " ⚠️ Swap space has only $ ( MB2String $free ) of $ ( MB2String $total ) left! "
5454 } elseif ($used -lt 3 ) {
55- Write-Output " ✅ Swap space unused - $ ( MB2String $free ) available "
55+ Write-Output " ✅ Swap space has $ ( MB2String $total ) reserved "
5656 } else {
57- [int64 ]$percent = ($free * 100 ) / $total
58- Write-Output " ✅ Swap space has $ ( MB2String $free ) of $ ( MB2String $total ) left ( $percent % )"
57+ [int64 ]$percent = ($used * 100 ) / $total
58+ Write-Output " ✅ Swap space uses $ ( MB2String $used ) ( $percent %) of $ ( MB2String $total ) "
5959 }
6060 exit 0 # success
6161} catch {
You can’t perform that action at this time.
0 commit comments