Skip to main content

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​

ParameterTypeDefaultRequiredDescription
job_namestringprometheusNoName assigned to the scrape job. Attached as the job label on scraped metrics.
collection_intervalstring30sNoHow often targets are scraped (e.g. 30s, 1m).
metrics_pathstring/metricsNoHTTP path on the target that exposes Prometheus metrics.
schemestringhttpNoProtocol scheme used to scrape targets. Options: http or https.
static_configsarraynoneNoTarget groups, each with a list of targets (host:port) and an optional labels map.

TLS Configuration​

Applies when scheme is https.

ParameterTypeDefaultRequiredDescription
insecure_skip_verifybooleanfalseNoDisable verification of the target server certificate.
ca_filestringnoneNoPath to the CA certificate used to verify the target server.
cert_filestringnoneNoPath to the client TLS certificate file.
key_filestringnoneNoPath to the client TLS private key file.
server_namestringnoneNoExpected server name override used to verify the target certificate.

Note: cert_file and key_file are only needed when the target requires mutual TLS. For ordinary HTTPS scraping, ca_file alone is enough.

Advanced Configuration​

ParameterTypeDefaultRequiredDescription
file_sd_filesarraynoneNoPaths to files used for file-based service discovery of targets.
scrape_configsarraynoneNoRaw Prometheus scrape_config objects passed through verbatim. Replaces the simple options above rather than adding to them.
trim_metric_suffixesbooleanfalseNoTrim 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
}