A single-binary system monitor for small Linux hosts, built for a Raspberry Pi running Pi-hole.
- One binary, no dependencies. Collectors, ring buffer, HTTP server and UI are all in one static executable. No agent, no database, no runtime.
- Nothing is written to disk. Samples live in memory. A monitoring daemon that writes a time series to an SD card is a monitoring daemon that eventually destroys the machine it monitors.
- No privileges. Everything is read from
/procand/sysas an unprivileged user, so the shipped systemd unit can be locked down hard. - No Node. The UI is Preact and uPlot bundled by esbuild's Go API, so
go buildis the only toolchain a contributor needs.
Collectors for CPU, memory, thermal, throttle, clock, disk, filesystem,
network, uptime and self-monitor are in tree, with a Prometheus /metrics
endpoint and a process top list. Packaging and release automation land via
GoReleaser. Every green push to main runs svu
against conventional commits (feat → minor, fix → patch, ! / BREAKING
CHANGE → major under v0 rules) and, when the version changes, tags and releases.
curl -fsSL https://raw.githubusercontent.com/felipefrizzo/pistat/main/scripts/install.sh | sudo bashOr download a binary from the releases page, or build from source:
git clone https://github.com/felipefrizzo/pistat
cd pistat
make buildThen install it as a service:
sudo install -m 0755 bin/pistat /usr/local/bin/pistat
sudo install -m 0644 packaging/pistat.service /etc/systemd/system/
sudo systemctl enable --now pistatOn first start pistat generates an access token, writes it to
/etc/pistat/config.toml with owner-only permissions, and logs it once:
journalctl -u pistat | grep 'generated a new access token'Open http://<host>:9700 and paste the token in.
Settings resolve in this order, each overriding the one after it: command-line flag, environment variable, configuration file, built-in default.
| Flag | Environment | File key | Default |
|---|---|---|---|
-listen |
PISTAT_LISTEN |
listen |
:9700 |
-tls-cert |
PISTAT_TLS_CERT |
tls_cert |
none |
-tls-key |
PISTAT_TLS_KEY |
tls_key |
none |
PISTAT_TOKEN |
token |
generated | |
-config |
/etc/pistat/config.toml when writable, else ~/.config/pistat/config.toml |
||
-interval |
1s |
||
-root |
/ |
listen = ":9700"
token = "..."
[collectors]
thermal = falsepistat serves plain HTTP by default, which means the session cookie crosses
your network in the clear. On a home LAN that is usually an accepted risk; if
it is not, set tls_cert and tls_key, or put pistat behind a proxy that
terminates TLS. The cookie only carries the Secure attribute when pistat
itself is serving HTTPS.
The API is read-only. There is no endpoint that kills a process, restarts a service or reboots the host, which keeps the attack surface of a daemon running next to your DNS server as close to zero as a network service gets.
| Endpoint | Purpose |
|---|---|
POST /api/login |
Exchange the token for a session cookie |
POST /api/logout |
Invalidate the session |
GET /api/session |
Whether the caller is authenticated |
GET /api/history?tier=live|history |
Backfill, as columnar JSON |
GET /api/stream |
Live samples, as Server-Sent Events |
GET /api/processes |
Top processes by CPU and RSS |
GET /metrics |
Prometheus text exposition |
Everything except login and the static bundle requires either the session
cookie or Authorization: Bearer <token>.
/api/history is columnar rather than an array of objects, which is both about
five times smaller and the exact shape the chart library consumes:
{
"tier": "live",
"step_ms": 1000,
"t": [1785878371026, 1785878372026],
"series": [
{ "key": "cpu.total", "label": "CPU", "unit": "percent", "v": [3.2, null] }
]
}A reading is null when the collector could not produce it for that sample.
Two tiers, both in memory, both lost on restart:
| Tier | Resolution | Window |
|---|---|---|
live |
1s | 5 minutes |
history |
10s average | 6 hours |
For anything longer, point Prometheus at pistat rather than making pistat into a database.
make ui # bundle the front-end into web/dist
make build # build for the host
make check # gofmt, go vet, go test
make run-fixture # run against captured fixtures, for UI work off-target
make help # everything elseweb/dist is a committed build artefact so that go build alone produces a
working binary. Re-run make ui after changing anything under web/src.
Every collector reads through an fs.FS rooted at /, so the entire set can
be pointed at a directory of captured kernel files and tested on any platform.
scripts/capture-fixtures.sh produces such a capture from a real host,
including a second sample one second later so that counter-delta logic is
exercised against real numbers rather than invented ones.
scp scripts/capture-fixtures.sh pi@raspberrypi:~/
ssh pi@raspberrypi './capture-fixtures.sh'The script reads only, needs no privileges, and skips process command lines and MAC addresses. Review a capture before committing anything from it: it contains the host's process list and mount layout.
Preact and uPlot are committed under web/vendor rather than installed,
because esbuild bundles but does not resolve packages from a registry, and
requiring npm would put Node back in the build. scripts/vendor-web-deps.sh
re-fetches them from the npm registry and verifies the published SHA-512
integrity hash. See web/vendor/README.md for versions
and licences.
Shipped:
- CPU total and per-core, memory and swap, SoC temperature
- Throttle/undervoltage latch, CPU clock, disk I/O, filesystem capacity, network rates, uptime, self-monitor
- Top processes via
/api/processes - Two-tier in-memory retention, SSE streaming, columnar backfill
- Token authentication with session cookies, optional TLS
- Prometheus
/metrics - Hardened systemd unit, GoReleaser, install script, CI
Possible later:
- Optional Pi-hole collector
- Remote sink / fleet mode
- Curated fixtures from more board models
Apache 2.0. See LICENSE.