Prometheus Source

The Vector prometheus source ingests data through the Prometheus text exposition format and outputs metric events.

Configuration

vector.toml
[sources.my_source_id]
type = "prometheus" # required
hosts = ["http://localhost:9090"] # required
scrape_interval_secs = 15 # optional, default, seconds
  • [string]commonrequired

    hosts

    Host addresses to scrape metrics from.

    • No default
    • View examples
  • int (seconds)commonoptional

    scrape_interval_secs

    The interval between scrapes, in seconds.

    • Default: 15 (seconds)
    • View examples

Examples

Given the following input:

Example input
# TYPE promhttp_metric_handler_requests_total counter
promhttp_metric_handler_requests_total{code="200"} 100

A metric event will be output with the following structure:

Example metric event
{
"name": "promhttp_metric_handler_requests_total",
"kind": "absolute",
"timestamp": "2019-05-02T12:22:46.658503Z" // current time / time ingested
"tags": {
"code": "200"
},
"value": {
"type": "counter",
"value": 100.0
}
}

How It Works

Environment Variables

Environment variables are supported through all of Vector's configuration. Simply add ${MY_ENV_VAR} in your Vector configuration file and the variable will be replaced before being evaluated.

You can learn more in the Environment Variables section.