mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-08 20:54:38 +02:00
Rename to check-cpu.ps1
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks the CPU temperature
|
||||
Checks the CPU
|
||||
.DESCRIPTION
|
||||
This script checks the CPU temperature.
|
||||
.EXAMPLE
|
||||
PS> ./check-cpu-temp
|
||||
✔️ CPU has 30.3 °C: good
|
||||
PS> ./check-cpu
|
||||
✔️ CPU has 30.3 °C
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -23,18 +23,18 @@ try {
|
||||
}
|
||||
|
||||
if ($Temp -gt 80) {
|
||||
"⚠️ CPU has $Temp °C: too high!"
|
||||
exit 1
|
||||
$Reply = "⚠️ CPU has $Temp °C: too high!"
|
||||
} elseif ($Temp -gt 50) {
|
||||
"✔️ CPU has $Temp °C: quite high"
|
||||
$Reply = "✔️ CPU has $Temp °C: quite high"
|
||||
} elseif ($Temp -gt 0) {
|
||||
"✔️ CPU has $Temp °C"
|
||||
$Reply = "✔️ CPU has $Temp °C"
|
||||
} elseif ($Temp -gt -20) {
|
||||
"✔️ CPU has $Temp °C: quite low"
|
||||
$Reply = "✔️ CPU has $Temp °C: quite low"
|
||||
} else {
|
||||
"⚠️ CPU has $Temp °C: too low!"
|
||||
exit 1
|
||||
$Reply = "⚠️ CPU has $Temp °C: too low!"
|
||||
}
|
||||
"$Reply"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
@ -8,7 +8,7 @@
|
||||
✔️ 1213 GB left for swap space (67 of 1280 GB used)
|
||||
✔️ 172 GB left on drive C (61 of 233 GB used)
|
||||
✔️ 30.3 °C CPU temperature - good
|
||||
✔️ 19.7 domains/s (177 domains resolved in 9 sec)
|
||||
✔️ DNS resolution is 19.7 domains per second
|
||||
✔️ 29 ms ping average (13 ms min, 110 ms max, 10 hosts)
|
||||
✔️ Windmill is healthy
|
||||
.LINK
|
||||
@ -18,8 +18,6 @@
|
||||
License: CC0
|
||||
#>
|
||||
|
||||
$Healthy = 1
|
||||
|
||||
& "$PSScriptRoot/check-swap-space.ps1"
|
||||
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||
|
||||
@ -31,25 +29,11 @@ if ($IsLinux) {
|
||||
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||
}
|
||||
|
||||
& "$PSScriptRoot/check-cpu-temp.ps1"
|
||||
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||
|
||||
& "$PSScriptRoot/check-cpu.ps1"
|
||||
& "$PSScriptRoot/check-dns.ps1"
|
||||
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||
|
||||
& "$PSScriptRoot/check-ping.ps1"
|
||||
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||
|
||||
if ($IsLinux) {
|
||||
& "$PSScriptRoot/check-smart-devices.ps1"
|
||||
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||
}
|
||||
|
||||
$Hostname = $(hostname)
|
||||
if ($Healthy) {
|
||||
"✔️ $Hostname seems healthy"
|
||||
exit 0 # success
|
||||
} else {
|
||||
write-warning "$Hostname is NOT healthy"
|
||||
exit 1
|
||||
}
|
||||
exit 0 # success
|
||||
|
Reference in New Issue
Block a user