# Thermal Monitor

One dashboard for the heat and load of my whole home lab: the MacBook Pro plus all four Ubuntu machines — both Kubernetes nodes and the edge and build boxes. Agents sample temperatures, load, memory, disk, fans and uptime, and a small Rust service stitches them together over Tailscale into a live, dark status page that answers “is anything running hot?” at a glance.

**Status:** Open source · Projects · 2026

- **Local checkout:** `/Users/simon/Developer/thermal-monitor` (branch `main`, last commit 9301856, 2026-10-23 — Add ubuntu01/02 agents and cover the whole home lab)
- **Uncommitted changes:** 7 file(s) at brief generation time
- **Repository:** https://github.com/ShimonNavon/thermal-monitor
- **On another machine:** `git clone https://github.com/ShimonNavon/thermal-monitor` — the paths below are Simon's Mac
- **Live:** https://thermal.navonsimon.com/
- **Where it runs:** namespace thermal-monitor · NodePort 30100 · TLS ingress on tailscale0:443 · tailnet only
- **Note:** Dashboard on my tailnet

## Stack

Rust, axum, Kubernetes DaemonSet, Traefik, systemd, launchd, macmon, journald

## Start here

- `src/` — serve / push / read binaries
- `deploy/deploy.sh` — build on ubuntu02, push through tunnel, rollout
- `deploy/k8s.yaml` — app Deployment/DaemonSet/Service plus the read-only cluster reporter
- `bin/thermal` — static binary used by Mac and non-Kubernetes Linux agents
- `docs/dashboard.png` — dashboard screenshot
- `deploy/tailnet-ingress.yaml` — Traefik TLS ingress for thermal.navonsimon.com, tailscale0 only
- `src/dashboard.html` — single-page dashboard: temps, security posture, problems feed, cluster panel

## Commands

- **Run server:** `cargo run -- serve`
- **One local sample:** `cargo run -- read`
- **Deploy:** `./deploy/deploy.sh`

## Deploy and where it runs

- Deployment on ubuntu04, NodePort 30100, namespace thermal-monitor.
- DaemonSet on every cluster node downloads /agent/binary from the server.
- The Fedora laptop (tailnet `home`) runs the static binary as a systemd user unit with HOST_LABEL=fedora and linger enabled; its Firefox tab opens the dashboard.
- ubuntu01 and ubuntu02 run the static binary as systemd user units (thermal-agent).
- Mac collector runs from launchd every 15 s.
- Traefik Deployment tailnet-ingress (deploy/tailnet-ingress.yaml) terminates TLS for thermal.navonsimon.com, bound only to 100.126.164.46:443, Let's Encrypt via Cloudflare DNS-01.

## Current state

Live at https://thermal.navonsimon.com on the tailnet. Covers temps, CPU and GPU utilisation, security posture (updates, reboot, failed units, SSH failures, firewall, ports), journal problems, and Kubernetes cluster health for the MacBook Pro, the Fedora laptop (host `home`, label `fedora`), and all four Ubuntu machines.

## Watch out

- Exactly one server replica: history is in memory and resets on rollout.
- Images must be built on ubuntu02 because the registry only listens on ubuntu04's loopback and is reached through an SSH tunnel.
- Without THERMAL_TOKEN the report endpoint is open; keep the token Secret in place.
- Mac sampling expects macmon on PATH.
- The ingress binds the literal tailscale IP 100.126.164.46; if ubuntu04's address changes, update the entrypoint and the Cloudflare A record.
- ACME uses Cloudflare DNS-01 (secret tailnet-ingress-cloudflare) because LE cannot reach a CGNAT-only host over HTTP-01.
- In the DaemonSet the agent reads host state through chroot /host (systemd, journal, apt); it runs as root in the pod but has no NET_ADMIN, so firewall state is unknown on cluster nodes.
- cluster-reporter reads the Kubernetes API with a read-only ClusterRole and posts to /api/cluster using the thermal-token Secret.
- Fedora has no apt: pending updates come from `dnf check-update` (exit 100) and firewall state from firewalld; the i5-1135G7 iGPU exposes RC6 residency but no temperature, so its GPU shows use % only.
- Linux CPU/GPU use is a 300 ms /proc/stat and RC6 delta taken inside each sample, so `thermal read` on Linux needs no cache.

## Secrets — locations only, never print values

- Kubernetes Secret thermal-token; Mac token file ~/.config/thermal-monitor/token (mode 600).

## Tags

Rust, axum, DaemonSet, macmon, Kubernetes

---

Brief generated 2026-11-16 from `~/Developer/my-projects/context/`. Canonical URL: https://projects.navonsimon.com/context/thermal-monitor.md
