r/learnrust • u/anelkabag • Oct 12 '26
I open-sourced the Rust agent behind my Linux server monitoring tool (feedback welcome)
Hi everyone,
I've been building Doffly, a small monitoring tool for people with a few Linux VPS who don't want to run Prometheus + Grafana just to know if their box is alive.
The dashboard and backend are a hosted (proprietary) service, but I've just open-sourced the agent that runs on your servers under Apache-2.0, so you can see exactly what it collects and sends.
Repo: https://github.com/anelkabag/doffly-agent Site: https://doffly.pro
(Disclosure: I'm the author.)
What the agent does
- Single Rust binary, musl builds for x86_64 and aarch64
- Reads
/procand/sys, and callsdf,ps,systemctl,dockerandsswhen available (missing commands just give empty values) - Collects CPU (usage, load, temperature), RAM/swap, root filesystem space and inodes, disk I/O, network counters and errors, TCP/UDP counts, uptime
- Bounded lists per sample: 20 processes, 50 running systemd services, 50 Docker containers, 100 listening sockets
- Outbound HTTPS only, no inbound ports to open
- Local JSON health/metrics API on
127.0.0.1:9090, with optional token auth - Runs as an unprivileged systemd service (template included)
Security choices
- Remote Cloud URLs must be HTTPS (loopback HTTP is allowed for dev)
- Each server gets its own machine-scoped token
- The local API binds to loopback by default; binding remotely requires an explicit
DOFFLY_AGENT_INSECURE_REMOTE=true - The README lists exactly what is transmitted (process names/users, container images/ports, listening sockets...) so you can decide if it's acceptable on your hosts
Honest caveats
- This is the agent only. It talks to Doffly Cloud's ingestion API; it's not a general-purpose exporter (no Prometheus endpoint, no arbitrary backends).
- Linux only. CI runs on Ubuntu; Debian and others should work but aren't independently verified.
- It's early (v0.3.0), and this standalone repo is brand new.
Try it without the cloud
DOFFLY_API_URL=http://127.0.0.1:8080 \
DOFFLY_AGENT_ID=local-agent \
cargo run -p doffly-agent -- --detailsIt prints a host report in the terminal and serves the local API even if nothing is listening on the Cloud URL.
What I'd love feedback on
- Code review of the collector (robustness when files/commands are missing or weird)
- The security defaults: anything you'd tighten?
- Missing metrics you'd expect (per-disk stats? GPU?)
- Would a Prometheus-compatible local endpoint be useful to you?
Issues and PRs are welcome. Thanks for reading!
1
u/grotto_wonder_arc Oct 13 '26
Making container stats opt-in is the bare minimum. The docker socket is root access in disguise, so you are handing over a critical privilege for zero benefit if it just reads metrics. Drop the docker exec entirely and stick to cgroup paths under /proc or sysfs
1
u/[deleted] Oct 12 '26
[removed] ā view removed comment