New CPU Temp Script

This commit is contained in:
zebra 2024-07-05 18:02:30 -07:00
parent df9e73fd1f
commit 0a93505b10
2 changed files with 16 additions and 2 deletions

15
poweredge-cputemp.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# Run sensors command and store the output
sensors_output=$(sensors)
# Extract temperatures for each CPU and find the highest core temp for each CPU
cpu1_temps=$(echo "$sensors_output" | awk '/coretemp-isa-0000/ {p=1} /coretemp-isa-0001/ {p=0} p' | awk '/Core/ {print $3}' | sort -n | tail -n 1)
cpu2_temps=$(echo "$sensors_output" | awk '/coretemp-isa-0001/ {p=1} /i350bb-pci-0103/ {p=0} p' | awk '/Core/ {print $3}' | sort -n | tail -n 1)
# Strip out the + and degree symbol from temperatures
cpu1_temps_clean=$(echo "$cpu1_temps" | tr -d '+°')
cpu2_temps_clean=$(echo "$cpu2_temps" | tr -d '+°')
# Format the final output
echo "CPU0: ${cpu1_temps_clean} | CPU1: ${cpu2_temps_clean}"

View File

@ -11,7 +11,6 @@ Conglomeration of PowerShell scripts to be used in tandem with an RMM<br />
<li>nvgpuload.sh - Checks GPU load and returns to stdout, also sends data via CURL</li>
<li>nvgputemp.sh - Checks GPU temps and returns to stdout, also sends data via CURL</li>
<li>officeversion.ps1 - Returns MS Office version in console</li>
<li>poweredge-cputemp.sh - Gets the CPU temp of a dual processor server (Dell PowerEdge in my use case) and returns the highest core temperature for both CPUs </li>
<li>spacesniffer-deploy.ps1 - Downloads SpaceSniffer and generates a SpaceSniffer snapshot file of desired drive.</li>
</ul>