mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-23 02:18:21 +02:00
Update check-dns.ps1, check-drives.ps1, and check-smart-devices.ps1
This commit is contained in:
parent
357a6f2fbb
commit
3375e6db6e
@ -2,7 +2,7 @@
|
|||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Checks the DNS resolution
|
Checks the DNS resolution
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script measures the DNS resolution speed by using 200 frequently used domain names.
|
This PowerShell script measures and prints the DNS resolution speed by using 200 frequently used domain names.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-dns
|
PS> ./check-dns
|
||||||
.LINK
|
.LINK
|
||||||
@ -28,13 +28,13 @@ try {
|
|||||||
$Average = [math]::round($NumRows / $Elapsed, 1)
|
$Average = [math]::round($NumRows / $Elapsed, 1)
|
||||||
|
|
||||||
if ($Average -gt 200.0) {
|
if ($Average -gt 200.0) {
|
||||||
"✅ $Average DNS domain lookups per second - excellent"
|
"✅ DNS resolves $Average domains per second - excellent"
|
||||||
} elseif ($Average -gt 100.0) {
|
} elseif ($Average -gt 100.0) {
|
||||||
"✅ $Average DNS domain lookups per second - quite good"
|
"✅ DNS resolves $Average domains per second - quite good"
|
||||||
} elseif ($Average -gt 10.0) {
|
} elseif ($Average -gt 10.0) {
|
||||||
"✅ $Average DNS domain lookups per second - good"
|
"✅ DNS resolves $Average domains per second - good"
|
||||||
} else {
|
} else {
|
||||||
"⚠️ $Average DNS domain lookups per second - poor"
|
"⚠️ DNS resolves $Average domains per second - poor"
|
||||||
}
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
Checks the free space of all drives
|
Checks the free space of all drives
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script checks all drives for free space left (20 GB by default).
|
This PowerShell script checks all drives for free space left (20 GB by default).
|
||||||
|
.PARAMETER MinLevel
|
||||||
|
Specifies the minimum warning level (10 GB by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-drives
|
PS> ./check-drives
|
||||||
.LINK
|
.LINK
|
||||||
@ -11,7 +13,7 @@
|
|||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param([int]$MinLevel = 50) # 50 GB minimum
|
param([int]$MinLevel = 10) # 10 GB minimum
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Drives = Get-PSDrive -PSProvider FileSystem
|
$Drives = Get-PSDrive -PSProvider FileSystem
|
||||||
@ -22,13 +24,12 @@ try {
|
|||||||
[int]$Total = ($Used + $Free)
|
[int]$Total = ($Used + $Free)
|
||||||
|
|
||||||
if ($Total -eq "0") {
|
if ($Total -eq "0") {
|
||||||
$Reply = "✅ Drive $($Drive.Name) is empty."
|
"✅ Drive $($Drive.Name) is empty."
|
||||||
} elseif ($Free -lt $MinLevel) {
|
} elseif ($Free -lt $MinLevel) {
|
||||||
$Reply = "⚠️ Drive $($Drive.Name) has only $Free GB left to use! $Used of $Total GB is in use."
|
"⚠️ Drive $($Drive.Name) has only $Free GB left to use! $Used of $Total GB is in use."
|
||||||
} else {
|
} else {
|
||||||
$Reply = "✅ Drive $($Drive.Name) has $($Free) GB left, $($Total) GB total."
|
"✅ Drive $($Drive.Name) has $($Free) GB left, $($Total) GB total."
|
||||||
}
|
}
|
||||||
"$Reply"
|
|
||||||
}
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
Specifies the type of selftest: either short (default) or long
|
Specifies the type of selftest: either short (default) or long
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-smart-devices
|
PS> ./check-smart-devices
|
||||||
✔️ short selftest started on S.M.A.R.T. device /dev/sda
|
✅ Started short selftest on S.M.A.R.T. device /dev/sda
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -28,7 +28,7 @@ try {
|
|||||||
$Array = $Device.split(" ")
|
$Array = $Device.split(" ")
|
||||||
$Device = $Array[0]
|
$Device = $Array[0]
|
||||||
$Result = (sudo smartctl --test=$type $Device)
|
$Result = (sudo smartctl --test=$type $Device)
|
||||||
"✔️ $type selftest started on S.M.A.R.T. device $Device"
|
"✅ Started $type selftest on S.M.A.R.T. device $Device"
|
||||||
}
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
Loading…
Reference in New Issue
Block a user