netmon

Home network monitoring, hop by hop. It exists so a question like "why was Michelle's Zoom call flaky at 1pm?" can be answered from data: was it her Wi-Fi link, the AP, the wired backbone, the gateway, or the ISP?

It runs on iso as two LaunchAgents:

  • run.fc.netmon is the Go daemon (netmon run). It:
    • pings every hop once a second from two vantages, iso's wired port (en0) and iso's Wi-Fi (en1). Each socket is pinned to its interface with IP_BOUND_IF. Targets: the gateway, AT&T's next hop, 1.1.1.1, 9.9.9.9, every AP and switch, and every Wi-Fi computer. Each target gets a summary every 10 s: sent, lost, min/avg/max RTT, jitter.
    • polls the UDM every 30 s for per-client Wi-Fi stats (AP, signal, rates, retries, satisfaction), per-AP radio utilization and interference, switch-port counters, WAN stats, and device CPU/memory.
    • copies UniFi's system log (roams, disconnects, …) into ~/Library/Application Support/netmon/events/YYYY-MM.jsonl, which keeps it past UniFi's own retention.
  • run.fc.netmon-vm is VictoriaMetrics, the TSDB. It listens on 127.0.0.1:8428 only, keeps data for 1 year, and stores it in ~/Library/Application Support/netmon/vmdata.

Answering "what happened at time X?"

netmon report -from "2026-11-12 13:00" -to "2026-11-12 14:00" -client "Mac 9d:f3"

This prints, one row per minute:

  • loss and RTT to the gateway, ISP and internet, from each vantage;
  • for the client: its AP and radio, signal, PHY rates, retries and satisfaction, its AP radio's utilization and interference, and pings to it;
  • the targets with the most loss over the range;
  • the client's UniFi events (roams, disconnects). Without -client, a per-client count of events instead.

Client names are UniFi's: the alias, or the hostname plus the last two MAC octets (Mac 9d:f3). A MAC works too.

For graphs, open http://127.0.0.1:8428/vmui and go to Dashboards → netmon. Raw PromQL works there as well; every metric is named netmon_*.

Install / update

./install.sh

The script builds, runs the tests, signs the binary with the Developer ID identity, installs ~/.local/bin/netmon, and (re)loads both LaunchAgents. The config, data and events are kept. On a first install it writes ~/Library/Application Support/netmon/config.json from config.example.json. The UniFi API key goes in unifi.api_key. It's the "netmon" key under Control Plane → Integrations on the UDM.

macOS asks once, on screen, before a launchd job may reach the LAN ("Allow netmon to find devices on local networks?"). Until someone clicks Allow, every LAN ping fails as lost and UniFi polling fails with "no route to host". The stable signature keeps the grant across rebuilds.

Config

See config.go for every field. The ones you're likely to touch:

  • vantages: name and interface for each place probes leave iso from.
  • targets: static ping targets. UniFi adds APs, switches, the ISP hop and Wi-Fi clients on its own.
  • ping_clients: computers pings every Wi-Fi client that UniFi fingerprints as a computer. Phones, watches and IoT aren't pinged by default, so they can sleep. include and exclude take names, hostnames or MACs.
S
Description
No description provided
Readme
204 KiB
0 Stars 1 Watchers 0 Forks
Languages
Go 94.9%
Shell 5.1%