mullane.info

Monitoring that can't ping, and an alert I had to prove

Undated · monitor

In November the house got a small monitoring box. It runs Gatus, which checks that each service is up, and ntfy, which delivers the alerts. Both run in rootless Podman like most things here. The agent installed it from the network (the netboot story is in the NAS’s post), and the box itself caused a few problems of its own.

The first was that it netbooted when it shouldn’t. After the install, the firmware’s boot list only had network entries in it: I’d set network boot first earlier on, and the install couldn’t add a boot entry for the disk, because bootctl can’t write firmware variables from inside the installer’s chroot. So the box booted from the network, the boot menu handed it back to the firmware, and it just sat there. It answered ping, which made it look alive, but that was the firmware’s own network stack answering; nothing else would connect. Putting the disk first in the BIOS fixed it, and later a bootctl install on the running system added a proper boot entry.

The second was that every ping check failed. Rootless Podman can’t send ICMP, so a check that pings something from inside the Gatus container can never succeed. The access points are now checked by connecting to their SSH port, and the switch by its web page, over TCP.

The third was that Gatus couldn’t reach ntfy, which runs on the same box. The error was “connection refused” on the box’s own address. Inside a container that uses pasta for networking, the host’s own address belongs to the container, so Gatus was knocking on its own door. The fix was to map ntfy’s name to host-gateway in the container’s settings. That keeps the proper name, so the TLS certificate still checks out, and the traffic reaches the host. The same applies to any container that has to talk to a service published on its own host.

Then the important part: proving an alert actually arrives. A monitoring system with a correct configuration and no tested alert is a nice dashboard. The agent added a temporary check against a port where nothing listens, set to fail on the first try. Gatus logged that it was sending an ntfy alert, and ntfy’s count of cached messages went up. Then the temporary check was removed again.

That’s the version of monitoring I trust: one that has sent at least one real alert, even if on purpose.