mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-25 05:26:47 +01:00
Rename to check-cpu.ps1
This commit is contained in:
parent
189a4fddf6
commit
a77df3fe52
@ -94,6 +94,12 @@ Computer, open `name` settings
|
||||
* when finished say: *Computer, close system settings* to stop the Windows settings.
|
||||
|
||||
|
||||
Computer, check `name`
|
||||
----------------------
|
||||
* let the computer check something.
|
||||
* replace `name` by: "CPU temperature", "DNS", "ping", or "swap space"
|
||||
|
||||
|
||||
🔊 Audio
|
||||
-------
|
||||
* *Computer, mute audio.*
|
||||
|
@ -47,9 +47,9 @@ Mega Collection of PowerShell Scripts
|
||||
|
||||
| Script | Description | Help |
|
||||
| ---------------------------------------------------- | ------------------------------------------------------------------ | --------------------------------------- |
|
||||
| [add-firewall-rules.ps1](Scripts/add-firewall-rules.ps1) | Adds firewall rules for the given executables (needs admin rights) | [Help](Docs/add-firewall-rules.md) |
|
||||
| [check-cpu-temp.ps1](Scripts/check-cpu-temp.ps1) | Checks the CPU temperature | [Help](Docs/check-cpu-temp.md) |
|
||||
| [check-dns.ps1](Scripts/check-dns.ps1) | Checks the DNS resolution | [Help](Docs/check-dns.md)|
|
||||
| [add-firewall-rules.ps1](Scripts/add-firewall-rules.ps1) | Adds firewall rules for the given executables (needs admin rights) | [Help](Docs/add-firewall-rules.md) |
|
||||
| [check-cpu.ps1](Scripts/check-cpu.ps1)| Checks the CPU temperature | [Help](Docs/check-cpu.md) |
|
||||
| [check-dns.ps1](Scripts/check-dns.ps1) | Checks the DNS resolution | [Help](Docs/check-dns.md) |
|
||||
| [check-drive-space.ps1](Scripts/check-drive-space.ps1) | Checks a drive for free space left | [Help](Docs/check-drive-space.md) |
|
||||
| [check-file-system.ps1](Scripts/check-file-system.ps1) | Checks the file system of a drive (needs admin rights) | [Help](Docs/check-file-system.md) |
|
||||
| [check-health.ps1](Scripts/check-health.ps1) | Checks the system health | [Help](Docs/check-health.md) |
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user