Watching small VPSes without drowning in emails

Also available in Italian.

Our software runs on a handful of small VPSes, none with much RAM to spare. One day someone happened to check one by hand: it was close to running out of memory. Nobody would have known until an instance slowed down or refused to start. So I taught our internal admin panel to look for itself.

Read-only, on purpose

Every five minutes the panel connects to each server over SSH with a key that can run exactly one command, a small helper that prints a JSON snapshot: memory, swap, disk, load, the database and web server, and every app instance on the host with its own memory. No shell, no write access. If the key ever leaked, the worst anyone could do is ask how much RAM is free.

Two levels, decided once

Warning when available memory drops below a floor, disk goes over 85% or swap over 50%; critical at half that floor, disk over 95%, or the database or web server down. The thresholds live in configuration, not in code, and each server’s page shows the ones in use.

Alerts that don’t spam

A value hovering around a threshold would send an email every five minutes. So an alert goes out only when the state changes, and only after two readings in a row agree. A failed reading doesn’t change the state at all: “I couldn’t read it” is not the same as “it’s fine” or “it’s on fire”, and the page says so in grey.

Pages you can decide with

Each server has a page with bars and the threshold marked on them, the instances it hosts, and the worst moment of each of the last seven days. When someone creates a new instance, the form warns if the chosen server is already struggling.

A server’s page in the admin panel, in Italian: bars for memory, swap and disk with the warning and critical thresholds marked on them, the load average, Postgres connections against the configured limit, the database and web server services, and the two app instances the server hosts with their memory and connections
One server's page in the panel (the UI is in Italian), with made-up host and instances

What I learned

A monitoring tool lives or dies by what it doesn’t send. Hysteresis, “unknown” states and a clear “this reading is old” matter as much as the checks themselves.

To be continued

Filed under#linux#monitoring#self-hosting

Keep reading

The project behind this postVPS health monitoringWatching a fleet of small VPSes from an internal admin panel: memory, disk, swap and services every 5 minutes, with thresholds and email alerts that don't spam.Active
  1. Also on #self-hostingRunning a Tor relay

Here, live

Presence

Thomas’s avatarFrieren, as Thomas’s avatarAsuka, as Thomas’s avatarRei, as Thomas’s avatarStatus unknown

Bari, Apulia
Bari, Apulia ·  local time
Now editing
—in—

Connecting…Blooming… (connecting)Synchronising… 82.4%. Obviously.Connecting. I will wait.

Viewers

Right now on site
—
On this page
—
All-time, site
—
All-time, this page
—

last 14 days · No tracking cookies, no IPs stored.

Connecting…Blooming… (connecting)Synchronising… 82.4%. Obviously.Connecting. I will wait.

Contents