Skip to main content

Monitoring

Health checks​

CheckCommand or addressExpected
APIhttps://bemba.ucp-pch.org/api/health200
Applicationhttps://bemba.ucp-pch.org/200
Documentationhttps://docubemba.ucp-pch.org/200
Containersdocker ps --format '{{.Names}}\t{{.Status}}'all Up, healthy when a check exists
E-mail queuedocker exec pch_backend php bin/console messenger:failed:showempty
Disk spacedf -h /under 80 %
Memoryfree -mcomfortable "available"

From inside the container (bypassing Traefik):

docker exec pch_backend curl -s http://127.0.0.1:8000/api/health

Metrics​

Production ships Prometheus exporters, bound to 127.0.0.1 (not exposed to the Internet):

ExporterPortMeasures
cAdvisor8080CPU, memory, network per container
node-exporter9100system (disk, load, memory)
postgres-exporter9187pch_sig database (connections, size, locks)
redis-exporter9121cache

Prometheus and Grafana do not run on the servers: they run on the admin workstation (monitoring/ folder of the repository, Grafana on port 3001). To reach the exporters, open SSH tunnels:

ssh -N -L 8080:127.0.0.1:8080 -L 9100:127.0.0.1:9100 -L 9187:127.0.0.1:9187 \
-L 9121:127.0.0.1:9121 -L 3100:127.0.0.1:3100 pch-prod

then point the targets in monitoring/prometheus/prometheus.yml to localhost and Grafana's Loki data source to http://localhost:3100.

note

The Prometheus configuration in the repository still targets the servers' public addresses, which no longer answer since the ports were bound to 127.0.0.1. Use the tunnels above.

Application errors​

Sentry receives frontend and backend errors, with context. It is the first place to look after a user report.

Warning signs​

SignalCommon causeAction
Every request returns 500 right after a cache:clearcache rebuilt by rootrecreate the backend container (see Troubleshooting)
https://… shows a "TRAEFIK DEFAULT CERT" certificateDNS missing when the certificate was requestedcheck DNS, then docker restart pch_traefik
Growing failed queueOVH SMTP down or password changedsee Configuration, E-mails section
Disk fulllogs, Docker imagesdocker image prune -f, docker builder prune -af
KoboToolbox returns 502 (pre-production)still starting (several minutes)wait, then docker ps --filter name=kobofe
Survey Solutions stoppedrestarted automatically by check-suso.sh every 5 minutesread ~/suso-healthcheck.log