Interview Prep/Monitoring & Observability/Prometheus scraping and targets

Pushgateway shows stale metrics from a batch job that stopped running a week ago

BeginnerTroubleshootingPrometheus scraping and targets
Answer

Likely causes → Pushgateway never expires groups; the last push persists until deleted.

Diagnose →

curl -s http://pushgateway:9091/metrics | grep push_time_seconds

Fix → Delete the group: curl -X DELETE http://pushgateway:9091/metrics/job/nightly_backup/instance/db1. Alert on freshness instead of the value:

time() - push_time_seconds{job="nightly_backup"} > 26*3600

Prevent → Use honor_labels: true on the Pushgateway job and only use it for batch jobs, never for long-running services.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus scraping and targets