Skip to content
linuxoperations

Health Check

health-checklinuxoperations
Plain English

A health check is a quick automatic test that something still works, like checking a shop’s lights are on and someone answers the door.

Technical Definition

Levels: process running (systemctl is-active), port listening (ss), correct response (curl -f returns 2xx).

  • Liveness: alive. Readiness: able to serve.
  • Load balancers and Docker HEALTHCHECK use them to route or restart.
  • Schedule with a systemd timer or cron; alert on failure.

Source: systemd.timer(5)

Health Check in practice

$ curl -fsS -o /dev/null -w "%{http_code}\n" http://localhost:8080/
200
$ docker inspect -f "{{.State.Health.Status}}" pihole
healthy
In the Wild

Health checks catch the outage before users do. BNLC lesson 8.6 builds one on a timer.