Initial inventory and rebuild plan for planck cluster

This commit is contained in:
Adam Carr
2026-09-19 09:35:04 -07:00
commit 5ff3d66d76
5 changed files with 152 additions and 0 deletions

36
scripts/inventory.sh Executable file
View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# Collects hardware + network inventory from all planck nodes.
# Usage: ./scripts/inventory.sh > docs/INVENTORY.md
set -u
FIRST=1
NODES="${NODES:-20}"
echo "# Planck Cluster Inventory"
echo ""
echo "Generated: $(date -Is)"
echo ""
echo "| Node | Model | RAM | SSD | IP | CPU Serial | Bootloader | Uptime | Temp |"
echo "|------|-------|-----|-----|----|-----------|------------|--------|------|"
for i in $(seq -w 1 "$NODES"); do
host="planck0${i}.local"
info=$(ssh -o BatchMode=yes -o ConnectTimeout=5 "adamcarr@${host}" '
model=$(tr -d "\0" < /proc/device-tree/model)
ram=$(awk "/MemTotal/ {printf \"%.0fGB\", \$2/1024/1024}" /proc/meminfo)
ssd=$(lsblk -dn -o SIZE,MODEL /dev/sda 2>/dev/null | tr -s " " | tr " " "/")
ip=$(ip -4 -o addr show eth0 | awk "{print \$4}" | cut -d/ -f1)
serial=$(grep -m1 Serial /proc/cpuinfo | awk "{print \$3}")
bl=$(vcgencmd bootloader_version 2>/dev/null | head -1)
up=$(uptime -p)
temp=$(vcgencmd measure_temp 2>/dev/null || cat /sys/class/thermal/thermal_zone0/temp)
echo "${model}|${ram}|${ssd}|${ip}|${serial}|${bl}|${up}|${temp}"
' 2>/dev/null)
if [ -z "$info" ]; then
echo "| planck0${i} | UNREACHABLE | | | | | | |"
else
IFS='|' read -r model ram ssd ip serial bl up temp <<< "$info"
sep=$FIRST && FIRST=0
echo "| planck0${i} | ${model} | ${ram} | ${ssd} | ${ip} | ${serial} | ${bl} | ${up} | ${temp} |"
fi
done