Prometheus
Overview
Prometheus scrapes metrics from targets that expose a Prometheus endpoint over HTTP. Targets are defined with static configs, file-based service discovery, or raw Prometheus scrape configs.
Supported platforms
- Linux:
Metrics - Windows:
Metrics - macOS:
Metrics
Basic Configuration
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
| job_name | string | prometheus | No | Name assigned to the scrape job. Attached as the job label on scraped metrics. |
| collection_interval | string | 30s | No | How often targets are scraped (e.g. 30s, 1m). |
| metrics_path | string | /metrics | No | HTTP path on the target that exposes Prometheus metrics. |
| scheme | string | http | No | Protocol scheme used to scrape targets. Options: http or https. |
| static_configs | array | none | No | Target groups, each with a list of targets (host:port) and an optional labels map. |
TLS Configuration
Applies when scheme is https.
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
| insecure_skip_verify | boolean | false | No | Disable verification of the target server certificate. |
| ca_file | string | none | No | Path to the CA certificate used to verify the target server. |
| cert_file | string | none | No | Path to the client TLS certificate file. |
| key_file | string | none | No | Path to the client TLS private key file. |
| server_name | string | none | No | Expected server name override used to verify the target certificate. |
Note:
cert_fileandkey_fileare only needed when the target requires mutual TLS. For ordinary HTTPS scraping,ca_filealone is enough.
Advanced Configuration
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
| file_sd_files | array | none | No | Paths to files used for file-based service discovery of targets. |
| scrape_configs | array | none | No | Raw Prometheus scrape_config objects passed through verbatim. Replaces the simple options above rather than adding to them. |
| trim_metric_suffixes | boolean | false | No | Trim unit and type suffixes (e.g. _total, _seconds) from metric names. |
Example Configuration
{
"job_name": "node-exporter", // default: "prometheus"
"collection_interval": "30s", // default: "30s"
"metrics_path": "/metrics", // default: "/metrics"
"scheme": "http", // default: "http"
"static_configs": [
{
"targets": ["localhost:9100", "10.0.0.5:9100"],
"labels": { "env": "prod" },
},
],
"file_sd_files": [], // default: none
"trim_metric_suffixes": false, // default: false
}