gpt-4.1-mini-2025-04-14· OpenAI
WildChat-4.8M (AI2)
prometheus yml syntax
- User
prometheus yml syntax
- Assistant
prometheus yml syntax
Prometheus configuration files use YAML syntax to define how Prometheus scrapes targets, processes rules, and stores data. Below is a basic overview of the syntax and common configuration sections found in a prometheus.yml file:
# Global configuration
global:
scrape_interval: 15s # How often to scrape targets
evaluation_interval: 15s # How often to evaluate rules
# Scrape configuration
scrape_configs:
- job_name: 'prometheus' # Name of the job
static_configs:
- targets: ['localhost:9090'] # List of endpoints to scrape
# Alerting rules (optional)
rule_files:
- "alerts.yml"
# Alertmanager config (optional)
alerting:
alertmanagers:
- static_configs:
- targets:
- 'alertmanager:9093'
Defines global settings like scrape intervals and external labels.
global:
scrape_interval: 15s
scrape_timeout: 10s
evaluation_interval: 30s
# External labels for federation and identification
external_labels:
cluster: 'us-east-1'
15s (seconds), 5m (minutes), etc.Defines the scrape jobs and their target endpoints.
scrape_configs:
- job_name: 'node_exporter'
static_configs:
- targets: ['host1:9100', 'host2:9100']
static_configs, file_sd_configs, dns_sd_configs, etc.<host>:<port> strings inside a list.A list of files containing alerting or recording rules.
rule_files:
- 'rules.yml'
- 'alerts.yml'
Configuration for integrating with Alertmanager.
alerting:
alertmanagers:
- static_configs:
- targets: ['alertmanager:9093']
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node_exporter'
static_configs:
- targets: ['host1:9100', 'host2:9100']
rule_files:
- 'alerts.yml'
alerting:
alertmanagers:
- static_configs:
- targets: ['alertmanager:9093']
- and nested structures are indented.s, m, h).If you want, I can also help you write a specific Prometheus config for your use case!
Not yet included in a published release.