probewatch
An uptime and certificate-expiry checker in Go: a REST API registers targets, a worker probes them, and a Kubernetes operator declares them as Probe resources.
Problem#
A service can be down, or its certificate can be a day from expiry, while its own metrics look normal. No traffic arrives, so no error counter moves. The only check that catches this is one that lives outside the service and calls it the way a client would.
Tools for this exist: blackbox_exporter, Gatus, Uptime Kuma, Kuberhealthy. I wanted one that
I had written, with the three forms a platform team needs from the same code: an API for
scripts, a worker that does the probing, and a Kubernetes custom resource so a team can declare
a check next to the Deployment it watches.
Approach#
probewatch is three long-running processes that share one PostgreSQL database.
| Process | Job | Needs Kubernetes |
|---|---|---|
| API | POST /targets, GET /targets/{id}/status | No |
| Worker | Probes each target at its interval and stores each result | No |
| Operator | Watches Probe resources and registers each one through the API | Yes |
- The API is the only door. The operator never writes to the database. It turns each
Proberesource into API calls, so the API and the worker run unchanged on a laptop with Docker Compose or in a cluster as Deployments. - A reader understands the system from
main.go. Configuration, store, handlers, middleware, and routes are all visible in one file. Handlers get their store through a struct field, so the dependencies are explicit. - Decisions are written down before code.
docs/FEATURES.mdcompares the four existing tools and records what probewatch does and does not do.docs/ARCHITECTURE.mdrecords the router choice, the package layout, and the path of one request from socket to database row. - Postgres from the start. Migrations run with goose. The API is stateless, so it scales sideways.
Outcome#
In progress. The API with its PostgreSQL store, validation, and middleware is written and
tested. Next: the worker, the probe function with certificate-expiry extraction, /metrics,
and then the Probe custom resource and its operator with Kubebuilder.