Fix: Temperature script now correctly reads actual temps, not thresholds (was showing 100°C instead of 70°C)

This commit is contained in:
PVE Monitoring System
2026-01-08 16:43:46 +08:00
parent d0e92d3bb8
commit 32efeb085e

View File

@@ -11,12 +11,12 @@ if ! command -v sensors &>/dev/null; then
exit 0
fi
# Get CPU temperature
TEMPS=$(sensors 2>/dev/null | grep -E "Core.*:.*°C" || echo "")
# Get CPU temperature - only extract the actual reading (first temperature value after colon)
TEMPS=$(sensors 2>/dev/null | grep -E 'Core.*:' | grep -oP ':\s+\+\K[0-9]+\.[0-9]+' || echo "")
if [ -n "$TEMPS" ]; then
# Extract highest temperature
MAX_TEMP=$(echo "$TEMPS" | grep -oP '\+\K[0-9]+' | sort -n | tail -1)
# Extract highest temperature (rounded to integer)
MAX_TEMP=$(echo "$TEMPS" | sort -n | tail -1 | cut -d. -f1)
if [ "$MAX_TEMP" -gt 90 ]; then
$SEND_NTFY critical "Temperature Critical" "🔴 CRITICAL: PVE CPU temperature at ${MAX_TEMP}°C! System may shut down!" "fire,skull,thermometer"