Documentation

prometheus.scrape() function

Flux 0.50.0+

The prometheus.scrape() function is experimental and subject to change at any time. By using this function, you accept the risks of experimental functions.

The prometheus.scrape() function retrieves Prometheus-formatted metrics from a specified URL. The function groups metrics (including histogram and summary values) into individual tables.

import "experimental/prometheus"

prometheus.scrape(
  url: "http://localhost:8086/metrics"
)

Parameters

url

The URL to scrape Prometheus-formatted metrics from.

Examples

Scrape Prometheus metrics and write them to InfluxDB

import "experimental/prometheus"

prometheus.scrape(url: "https://example-url.com/metrics")
  |> to(
    org: "example-org",
    bucket: "example-bucket"
  )

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.