Skip to main content
Once Prometheus is installed and one or more hosts are exposing metrics, you must configure Prometheus so it knows which targets to scrape. Prometheus uses a pull model: the server is explicitly configured to retrieve metrics from targets. These settings live in the Prometheus YAML configuration file (commonly /etc/prometheus/prometheus.yml). Example minimal Prometheus config:
Overview of important sections
  • global: Default parameters that apply to all scrape jobs. Individual scrape_configs can override these defaults.
  • scrape_configs: Defines jobs (logical groups of targets) and how Prometheus should scrape them. Each job may define its own scrape_interval, scrape_timeout, metrics_path, scheme, authentication, discovery mechanism, and static targets.
A more detailed example showing per-job overrides and a node metrics job:
Note: the example below demonstrates overriding defaults for a job; scheme and metrics_path are illustrative. Most exporters use http and the default metrics_path (/metrics).
Common fields and what they do
  • job_name: Logical name for the job — added as a job label to all scraped metrics.
  • scrape_interval: How often Prometheus pulls metrics from targets in this job.
  • scrape_timeout: How long Prometheus will wait for a scrape before it times out.
  • metrics_path: HTTP path where metrics are exposed (defaults to /metrics).
  • scheme: http or https (defaults to http).
  • static_configs.targets: List of host:port targets to scrape (Node Exporter commonly uses port 9100).
  • basic_auth: If targets require basic auth, set username and either password or password_file (mutually exclusive).
Table: Common scrape config fields Reference-style documented options:
Editing the configuration and reloading Prometheus
  1. Edit the config file (example path):
  1. After saving changes, Prometheus does not automatically pick them up. You have several options to apply the new config:
  • If you started Prometheus manually (for example with ./prometheus --config.file=/etc/prometheus/prometheus.yml), stop it with Ctrl+C and start it again the same way.
  • Send a SIGHUP to the Prometheus process to request a config reload:
  • If Prometheus is managed via systemd, restart it:
After updating prometheus.yml, restart Prometheus, send a SIGHUP, or use the /-/reload HTTP endpoint (if available) so new scrape jobs take effect.
Verifying targets in the Prometheus UI
  • Open the Prometheus UI at http://<prometheus-host>:9090/.
  • Navigate to Status -> Targets to view all configured targets and their scrape status. A green “UP” indicates a successful scrape.
Example output showing two targets appears in the Prometheus Targets view:
The image shows a Prometheus monitoring dashboard with two targets labeled "node" and "prometheus." Both targets are in an "UP" state, indicating successful data scraping.
You can also confirm target status by querying the up metric in the Prometheus expression browser:
Putting it together — a common /etc/prometheus/prometheus.yml example
This minimal configuration allows Prometheus to scrape itself and a Node Exporter instance. From here you can extend jobs with service discovery, relabeling, authentication, TLS settings, alerting, and rule files as required. Links and references

Watch Video

Practice Lab