Prometheus Configuration Guide
Prometheus uses command-line flags and YAML configuration files to manage scraping, alerting rules, and storage. Learn how to configure Prometheus for your monitoring stack.
Prometheus utilizes two configuration methods: command-line flags and configuration files. Command-line flags set immutable system parameters like storage locations and data retention policies, while configuration files manage scraping jobs, instances, and rule file loading.
To access all available command-line options, execute:
./prometheus -h
Runtime Configuration Reloading
Prometheus supports configuration reloading without downtime. Invalid configurations prevent changes from being applied. Reloads are triggered by:
- Sending a
SIGHUPsignal to the process - Posting to the
/-/reloadendpoint when the--web.enable-lifecycleflag is enabled
Rule files are also reloaded during this process.
Configuration File Format
Specify the configuration file using the --config.file flag. Files use YAML format with optional parameters indicated by brackets. Default values apply to non-list parameters.
The documentation defines generic placeholders for various data types:
- Boolean values (
true/false) - Duration strings matching regex patterns
- Identifiers, strings, and URLs
- Hostnames with optional ports
- HTTP/HTTPS protocol specifications
- Template-expandable strings
Example: Basic Scrape Configuration
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'kubernetes-pods'
kubernetes_sd_configs:
- role: pod
A valid example configuration is available in the official Prometheus documentation.
Get Started for Free
Schedule a free consultation with our AI agents team. 30-minute call, actionable results in days.
Talk to an Expert