Prometheus is configured using a YAML file, typically named prometheus.yml.
This file defines what Prometheus monitors, how often it collects metrics, and how alerts are handled.
Key Sections
global — Defines default settings applied across all jobs, such as:
scrape_interval (how often Prometheus pulls metrics)
evaluation_interval (how often alerting rules are evaluated)
scrape_configs — Defines the list of targets Prometheus will monitor. Each job specifies:
A job name
The target endpoints
Optional labels or custom intervals
rule_files — Points to files containing alerting and recording rules.
alerting — Configures how Prometheus communicates with Alertmanager.
Reloading Configuration
After modifying prometheus.yml, Prometheus must reload the configuration. You can do this by:
Sending a SIGHUP signal to the Prometheus process
Sending an HTTP POST request to http://localhost:9090/-/reload (only works if --web.enable-lifecycle is enabled)
This is a minimal but realistic configuration that scrapes Prometheus itself, scrapes a sample application, connects to Alertmanager, and loads alerting rules.