Add temperature monitoring and optional server URL links to dashboard
All checks were successful
Build-Publish / build (linux/amd64) (push) Successful in 5s
Build-Publish / build (linux/arm64) (push) Successful in 11s
Build-Publish / create-manifest (push) Successful in 2s
Build-Publish / publish-template (push) Successful in 7s

This commit is contained in:
j
2026-03-07 23:08:57 +13:00
parent d8338bbf82
commit df29cd88de
5 changed files with 96 additions and 4 deletions

View File

@@ -45,6 +45,29 @@ else
echo "usage_percent=0.0"
fi
# Temperatures - try sensors (lm-sensors), fall back to thermal zones
echo "[temperatures]"
if command -v sensors &>/dev/null; then
sensors 2>/dev/null | awk -F'[: ]+' '
/^[^ ]/ { chip=$1 }
/°C/ {
label=$1
gsub(/^ +| +$/, "", label)
match($0, /[+-]([0-9]+\.[0-9]+)°C/, m)
if (m[1]+0 > 0) print chip "/" label "=" m[1]
}
'
else
for tz in /sys/class/thermal/thermal_zone*; do
[ -f "$tz/temp" ] || continue
type=$(cat "$tz/type" 2>/dev/null || echo "unknown")
temp_mc=$(cat "$tz/temp" 2>/dev/null || echo 0)
temp_c=$((temp_mc / 1000))
temp_frac=$(( (temp_mc % 1000) / 100 ))
[ "$temp_c" -gt 0 ] 2>/dev/null && echo "${type}=${temp_c}.${temp_frac}"
done
fi
echo "[memory]"
total_kb=$(grep MemTotal /proc/meminfo 2>/dev/null | awk '{print $2}')
available_kb=$(grep MemAvailable /proc/meminfo 2>/dev/null | awk '{print $2}')