Network monitor: hub, probes, Docker and native installers

Hub (FastAPI + no-build web UI):
- Network health: live probe/target matrix, status strips, incidents
- Probes: add (with install command), rename, remove, latency and throughput charts
- Clients merged from AdGuard, DHCP, query log and probe ARP tables; names,
  categories, suspicious flag, notes, per-client DNS requests
- Query log, domain detail (clients, related subdomains), blocked domains via
  the AdGuard Home /control API

Probe: tests peers (ping, HTTP, throughput), gateway, LAN and public DNS,
internet URLs and an optional VPS; buffers results while the hub is down.
Gateway and ARP from /proc/net on Linux, route/arp on macOS.

Install: install.sh (hub) and install-probe.sh (generated from it), each in
docker mode (compose; default on Linux hosts) or native mode (venv + systemd
or launchd; default on macOS and in LXC). Both modes deploy with an update
command that checks the new commit and rolls back on failure.

CLAUDE.md carries shared context for Claude Code sessions on each machine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
neil 2026-11-04 18:10:29 -08:00
commit 54a765510a
63 changed files with 6464 additions and 0 deletions

57
.env.example Normal file
View file

@ -0,0 +1,57 @@
# install.sh writes .env from this file on the server (see README).
# Gitignored. The container reads it at startup and on every `update`, so edits apply on the
# next update or restart; no rebuild. Plain KEY=value lines; quotes optional; not executed.
# The remote the container pulls the source from, and the branch/tag it follows.
REPO_URL=https://git.neilbantoc.dev/services/network-monitor.git
REPO_REF=main
# Private repo over https: a read-only access token (GitHub fine-grained token with
# Contents: read, GitLab deploy token, ...). Leave empty for a public repo.
GIT_USERNAME=
GIT_TOKEN=
# Or private repo over SSH: an ssh REPO_URL (git@host:owner/repo.git) and a read-only deploy
# key, base64-encoded on one line: base64 -w0 deploy_key
GIT_SSH_KEY=
# docker or native (systemd / launchd). Set by the installer; see install.sh.
INSTALL_MODE=
# The port the hub listens on.
HOST_PORT=8000
# App settings go below; the app sees them as environment variables.
# Bind address for HOST_PORT. Probes on other machines report here, so the LAN default is
# 0.0.0.0. Use 127.0.0.1 if a reverse proxy on this machine fronts the hub.
HOST_BIND=0.0.0.0
# Optional password for the web UI (HTTP basic auth; any username). Probes use their own tokens.
UI_PASSWORD=
# AdGuard Home: its web UI address and an admin login. Leave ADGUARD_URL empty to skip DNS features.
ADGUARD_URL=
ADGUARD_USERNAME=
ADGUARD_PASSWORD=
# What probes test. Every probe also tests every other probe and its default gateway.
PROBE_INTERVAL=30
# DNS servers queried as "LAN" (default: the AdGuard host) and as "internet".
LAN_DNS_SERVERS=
DNS_SERVERS=1.1.1.1,8.8.8.8,9.9.9.9
DNS_QUERY_NAME=example.com
WAN_HTTP_URLS=http://connectivitycheck.gstatic.com/generate_204
# A VPS running a probe in serve-only mode (install-probe.sh with no HUB_URL), e.g. http://vps.example.com:8765
VPS_URL=
# Timed download between probes: every N reports, N bytes from each peer. 0 turns it off.
THROUGHPUT_EVERY=10
THROUGHPUT_BYTES=4000000
# When a check counts as slow (ms), and how long measurements are kept.
SLOW_LAN_MS=100
SLOW_WAN_MS=200
SLOW_DNS_MS=250
RETENTION_DAYS=14
# The hub address shown in probe install commands (default: the address in your browser).
HUB_PUBLIC_URL=