docs-v2/content/influxdb/cloud/reference/flux/stdlib/experimental/prometheus/scrape.md

1.0 KiB

title description menu weight related
prometheus.scrape() function The `prometheus.scrape()` function retrieves Prometheus-formatted metrics from a specified URL.
influxdb_cloud_ref
name parent
prometheus.scrape Prometheus
401
/influxdb/cloud/write-data/no-code/scrape-data//scrapable-endpoints/

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

Function type: Input

import "experimental/prometheus"

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

Parameters

url

The URL to scrape Prometheus-formatted metrics from.

Data type: String

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