Interview Prep/Monitoring & Observability/Prometheus scraping and targets

`file_sd_configs` targets never change even though the JSON file was updated

BeginnerTroubleshootingPrometheus scraping and targets
Answer

Likely causes → The file was written outside the watched glob, the JSON is invalid (Prometheus keeps the last good version), or a ConfigMap update has not propagated yet.

Diagnose →

jq . /etc/prometheus/file_sd/nodes.json
journalctl -u prometheus | grep -i 'file_sd\|discovery'

Check prometheus_sd_file_read_errors_total.

Fix → Write files atomically (write temp, then mv), fix JSON, and make sure the glob in files: matches.

Prevent → Alert on increase(prometheus_sd_file_read_errors_total[10m]) > 0.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus scraping and targets