What is `file_sd_configs` and when is it useful?
IntermediateConceptPrometheus Architecture
Answer
Prometheus watches JSON or YAML files listing targets and reloads them on change, without a restart. It is the universal integration point: Ansible, Terraform or a cron script writes the file, and Prometheus picks it up.
- job_name: legacy
file_sd_configs:
- files: ["/etc/prometheus/targets/*.json"]
refresh_interval: 1m
[{"targets": ["10.0.2.5:9100"], "labels": {"env": "prod", "team": "billing"}}]
More on Prometheus Architecture
Describe the Prometheus architecture.BeginnerWhat does a basic prometheus.yml look like?BeginnerWhat is the `up` metric?BeginnerWhat are `job` and `instance` labels and where do they come from?BeginnerHow is the Prometheus TSDB organized on disk?AdvancedWhat is the WAL and why does Prometheus restart slowly sometimes?Advanced