docs-v2/content/flux/v0.x/stdlib/experimental/prometheus/scrape.md

1.2 KiB

title description aliases menu weight flux/v0.x/tags related introduced
prometheus.scrape() function The `prometheus.scrape()` function retrieves Prometheus-formatted metrics from a specified URL.
/influxdb/v2.0/reference/flux/stdlib/experimental/prometheus/scrape/
/influxdb/cloud/reference/flux/stdlib/experimental/prometheus/scrape/
flux_0_x_ref
name parent
prometheus.scrape prometheus
401
inputs
/{{< latest "influxdb" >}}/write-data/no-code/scrape-data/scrapable-endpoints/
0.50.0

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

{{< keep-url >}}

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")