skip to content
4 min#networking#tui#tools

A ping is not monitoring

Every network problem I've chased started the same way: something feels slow, someone runs ping, the ping succeeds, and the investigation stops there. The reply showed that the link was fine for one packet, once, from one place.

kPong is what came out of taking that annoyance seriously. This note is about the gap between a ping and an answer, and what a small tool has to do to close it.

What a single ping can't see

A successful reply proves reachability at one instant. The problems that ruin an evening live everywhere else:

  • Jitter (variation in latency between probes). A link sitting at 20 ms with spikes to 800 ms feels broken. A single manual check almost always lands between the spikes and reports the 20 ms.
  • Brief outages. A connection that drops for three seconds every few minutes passes almost every manual check and fails almost every video call. A monitor only catches what its probe interval (scheduled time between checks) can see. kPong probes each target every second by default, and any target can set its own interval from 100 ms up to an hour.
  • Patterns. Degradation that follows a schedule, like evening congestion or a nightly backup window, is invisible without history.
  • Scope. One target can't tell you whether the problem is your Wi-Fi, your ISP, or the far end. Watching several targets at once narrows it down: if your router answers while every external target times out, you know the local hop still answers pings even though nothing past it does.

What it takes instead

None of the ingredients are exotic. Each one closes a gap from the list above.

Scheduling. kPong probes each target on its own timer for as long as it runs, whether or not anyone is looking at the screen. A target never overlaps its own previous probe, and a global cap (20 concurrent pings by default) limits the total; a target that hits the cap waits in a queue and runs as soon as a slot frees up. When the scheduler stops or probing settings change on reload, kPong aborts in-flight probes, and a generation counter (a run identifier that rejects older results) discards any result that still arrives from the previous run.

Baseline. The reference point is the median (the middle value after sorting samples) of a rolling window (the last 60 samples by default), not the mean. The mean is a lazy default here: with 59 samples at 20 ms and one at 900 ms, it jumps to about 35 ms, while the median stays at 20. That stability is what you want from the number that defines "normal". The tail still gets watched; spike detection measures it against that baseline.

Spike detection. A sample counts as a spike only when it clears three bars at once: at least 20 ms over the baseline, at least 40% over it, and at least 15 ms above the previous sample. Those are the defaults, and every target can override them. The absolute bar keeps a 3 ms LAN target from alerting on a 5 ms reading; the relative bar keeps a 150 ms link from alerting on 175 ms. After a spike fires, the target stays quiet for a 30-second cooldown (delay before another alert can fire) and doesn't rearm until latency falls back within 15% of the baseline, so a sustained slowdown doesn't trigger an alert on every probe.

States. Every sample is ok, timeout, dns_error, unreachable, or unknown. The split matters because a resolver problem and a dead route feel identical from the couch and have different fixes. kPong labels them separately (DNS error, Down, and Degraded for timeouts), and a target reads Spike while every one of its pings still succeeds.

History. kPong writes every sample to a local SQLite database with its latency, state, and baseline. Without a retention window it keeps the newest 100,000 rows per target, a bit over a day at the 1 s default; set storage.sqlite.retentionDays to keep a week of evenings instead. Pressing x exports a timestamped CSV and JSON snapshot of each target's current reading. "The link degrades every evening at eight" is an argument you can have with an ISP once you have a week of rows to query.

Terminal UI. kPong is a single executable that runs in any terminal, including over SSH on whichever box sits closest to the problem. You add, edit, rename, mute, and disable targets from the keyboard while it runs; r reloads the config, and a theme file reloads on its own when you save it.

What it still isn't

kPong only observes latency and reachability from the machine it runs on. It can show you that a link is degrading, since when, and how badly. It can't tell you why: it won't name the guilty cable, and it doesn't try to be a monitoring platform with servers and pager rotations. It also shells out to the system ping, so what it measures is ICMP (network protocol used by ping for control and diagnostic messages). Routers may rate-limit ICMP or answer it at low priority, so a spike on a router target can mean the router is busy while your traffic passes through fine. A clean graph also says nothing about problems that only hit large packets or specific ports.