Interview Prep/Monitoring & Observability/Prometheus scraping and targets

A target disappeared from `/targets` entirely after a config change

BeginnerTroubleshootingPrometheus scraping and targets
Answer

Likely causes → A relabel_configs keep/drop rule filtered it, the reload failed silently, or service discovery no longer finds it.

Diagnose → Open /service-discovery in the UI: dropped targets are listed with their discovered labels. Then:

promtool check config /etc/prometheus/prometheus.yml
curl -s localhost:9090/api/v1/status/config | head

Check prometheus_config_last_reload_successful.

Fix → Correct the relabel regex (anchored by default: regex: web does not match web-1), fix the config and reload with curl -X POST localhost:9090/-/reload (needs --web.enable-lifecycle).

Prevent → Run promtool check config in CI and alert on prometheus_config_last_reload_successful == 0.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus scraping and targets