Skip to main content

Prometheus

With the Prometheus connection you can use the Capture collector as a Prometheus remote write destination. This way, you can send data collected by Prometheus to Capture.

Configuration in Prometheus

Configure Prometheus to collect the data you want. See the Prometheus documentation for more info.

In the configuration file, you add the code below to send all data to the Capture Collector:

remote_write:
- url: "http://collector:5002/api/ingest/prometheus/receive"

If necessary, replace the hostname of the URL to the hostname of the collector service. When running in docker this is normally 'collector'. When running on Windows or Linux natively, it is normally 'localhost'.

Configuration in Capture

First, add a Prometheus connection. Then, in the variables you define what data is stored under what name. If you leave the mapping empty, or put an '*', all data will be collected under that variable.

Prometheus outputs data in metrics, and each datapoint can have multiple labels attached to it. The labels have a key and a value. In the mapping of the variable, you can use a subset of the Prometheus query language to select specific Prometheus data points. We support mappings with and without label filters. The label filters support static (=) and Regex (=~) comparison.

Examples:

MappingExplanation
container_cpu_usage_seconds_totalCollect the metric container_cpu_usage_seconds_total
container_cpu_usage_seconds_total{name="redis"}Collect the metric container_cpu_usage_seconds_total where the value of the label 'name' equals 'redis'
container_cpu_usage_seconds_total{name=~"influx.*"}Collect the metric container_cpu_usage_seconds_total where the value of the label 'name' starts with 'influx'
container_network_transmit_bytes_total {image=~"influx.*",interface="eth0"}Collect the metric container_network_transmit_bytes_total where the value of the label 'image' starts with 'influx' and the value of the label 'interface' equals 'eth0'
container_cpu_usage_seconds_total{job=~".*server"}Collect the metric container_cpu_usage_seconds_total where the value of the label 'job' ends with 'server'