prometheus.yml
The YAML file that tells Prometheus what to scrape, how often, and which rule files to load.
In more detail
It has a global section for intervals, a rule_files list for alerting and recording rules, and scrape_configs listing jobs and their targets. In a real cluster targets usually come from service discovery instead of static_configs.
Example
- job_name: checkout
metrics_path: /metrics
static_configs:
- targets: ["service:8000"]Related terms
- scrape job — A named group of scrape targets that do the same work, such as all instances of the checkout service.
- scrape interval — How often Prometheus fetches each target, such as every 15 seconds.
- alerting rule — A Prometheus rule with a PromQL expression that describes an unhealthy condition, plus a for duration, labels and annotations.
- YAML — A human-friendly text format for configuration, where indentation shows structure.
Taught in
- Prometheus Scraping And The Pull Model — Full-Stack Observability: Metrics, Tracing & Logging
- The Prometheus Exposition Format — Full-Stack Observability: Metrics, Tracing & Logging
- Forty Seconds At Two: Push, Pull And Service Discovery — Prometheus Certified Associate (PCA) Exam Prep
- Where Did Two Hours Go? Prometheus Architecture — Prometheus Certified Associate (PCA) Exam Prep
- A Week Without A Scrape: Configuration And Relabelling — Prometheus Certified Associate (PCA) Exam Prep
- Fundamentals Sprint: Nine Calls On The Server — Prometheus Certified Associate (PCA) Exam Prep
- A Database You Cannot Recompile: Exporters — Prometheus Certified Associate (PCA) Exam Prep
- Seventy Seven Percent, Book Now? The Full Mock — Prometheus Certified Associate (PCA) Exam Prep
- One Week, Three Objectives: Final Review — Prometheus Certified Associate (PCA) Exam Prep