Publishes key server metrics (CPU, memory, uptime, disk usage, RAID, drive health, and optional NVIDIA GPU) to an MQTT broker with Home Assistant autodiscovery support.
All configuration is YAML-based; each module can be toggled individually.
| Metric Type | Source | MQTT Topic Prefix | Notes |
|---|---|---|---|
| CPU usage / temp | /proc/stat, sensors |
<base>/cpu_* |
Temp label customizable |
| Memory available % | /proc/meminfo |
<base>/memory_available |
Uses MemAvailable / MemTotal |
| Uptime (days) | /proc/uptime |
<base>/uptime_days |
2 decimals if < 10 days |
| Disk usage % | statvfs |
<base>/disk_usage/<mount> |
Automatically resolves device → mountpoint |
| RAID active members | mdadm -D /dev/mdX |
<base>/raid/<md> |
Only if listed |
| Drive health | HDSentinel -solid |
<base>/health_<disk> |
Cached, throttled (default 30 min) |
| NVIDIA GPU | nvidia-smi |
<base>/gpu/... |
Temp °C, Util %, VRAM % free |
- Debian ≥ 12
- Python ≥ 3.9
- Packages:
paho-mqtt,PyYAML - Optional tools:
lm-sensors(CPU temp)HDSentinelCLI in/root/HDSentinelmdadmfor RAIDnvidia-smifor GPU metrics
Install:
sudo apt install python3-venv lm-sensors mdadm
cd /root/server-status
python3 -m venv .
./bin/pip install paho-mqtt PyYAMLEdit server-status.yaml:
mqtt:
host: 192.168.1.65
username: mqtt
password: mqtt_password
base_topic: SERVER
device:
name: SERVER
identifiers: ["SERVER"]
modules:
cpu_usage: true
cpu_temp: true
memory: true
uptime: true
disks: true
raids: true
health: true
gpu: true # enable NVIDIA GPU metrics
mounts:
root: /
storage1: /dev/mapper/storage1
backup: /dev/mapper/backup
disks: ["sda", "sdb"]
raids: ["md0", "md1"]
hdsentinel_path: /root/HDSentinel
loop_seconds: 60Missing sections or false disable that metric entirely.
./bin/python3 server-status.py -c server-status.yamlRun once and exit:
./bin/python3 server-status.py -c server-status.yaml --onceCreate /etc/systemd/system/server-status.service:
cd ./server-status
cp server-status.service /etc/systemd/system/server-status.serviceActivate:
systemctl daemon-reload
systemctl enable --now server-status.service
journalctl -u server-status.service -fEach sensor is auto-discovered under the MQTT discovery prefix (default homeassistant/).
Example topics:
SERVER/cpu_usage
SERVER/gpu/temp
SERVER/health_sda
SERVER/raid/md0
Availability topic: <base>/availability.
- HDSentinel runs at most once every 30 minutes to avoid waking drives.
- Percentages are published as integers.
- GPU metrics require driver and
nvidia-smiavailable in the systemd environment. - Tested on Debian 12 with Python 3.11 and NVIDIA 525+.