Skip to content

Commit f0272d1

Browse files
author
Markus Fleschutz
committed
Updated check-swap-space.ps1
1 parent 2a11234 commit f0272d1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

scripts/check-swap-space.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
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 {

0 commit comments

Comments
 (0)