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

42
compose.yml Normal file
View file

@ -0,0 +1,42 @@
# The hub (web UI + API). install.sh sets this up on a server (see README); by hand it is:
# clone into /opt/network-monitor, write .env from .env.example, docker compose up -d --build
# Deploys after that: docker exec network-monitor update
name: network-monitor
services:
app:
build:
context: .
dockerfile: container/Dockerfile
image: network-monitor:latest
container_name: network-monitor
restart: unless-stopped
environment:
ROLE: hub
CONTAINER_NAME: network-monitor
# Only a reverse proxy at these addresses may set X-Forwarded-For.
FORWARDED_ALLOW_IPS: ${FORWARDED_ALLOW_IPS:-127.0.0.1}
# Probes on other machines report here, so .env sets HOST_BIND=0.0.0.0 (LAN). Use
# HOST_BIND=127.0.0.1 behind a reverse proxy.
ports:
- "${HOST_BIND:-127.0.0.1}:${HOST_PORT:-8000}:8000"
volumes:
- runtime:/srv # source checkout, venv, update state
- data:/data # the app's persistent data
# Repo URL, credentials and app settings, read on every start and every update.
# Not env_file: a mounted file can change without recreating the container.
- ./.env:/run/config/app.env:ro
read_only: true
tmpfs:
- /tmp
cap_drop: [ALL]
security_opt:
- no-new-privileges:true
mem_limit: 256m
logging:
driver: json-file
options:
max-size: 10m
max-file: "3"
volumes:
runtime:
data: