Documentation

Prometheus endpoints support in InfluxDB

Prometheus remote read and write API support

Note: The Prometheus API Stability Guarantees states that remote read and remote write endpoints are features listed as experimental or subject to change, and thus considered unstable for 2.x. Any breaking changes will be included in the InfluxDB release notes.

InfluxDB support for the Prometheus remote read and write API adds the following HTTP endpoints to InfluxDB:

  • /api/v1/prom/read
  • /api/v1/prom/write

Additionally, there is a /metrics endpoint configured to produce default Go metrics in Prometheus metrics format.

Create a target database

Create a database in your InfluxDB instance to house data sent from Prometheus. In the examples provided below, prometheus is used as the database name, but you’re welcome to use the whatever database name you like.

CREATE DATABASE "prometheus"

Configuration

To enable the use of the Prometheus remote read and write APIs with InfluxDB, add URL values to the following settings in the Prometheus configuration file:

The URLs must be resolvable from your running Prometheus server and use the port on which InfluxDB is running (8086 by default). Also include the database name using the db= query parameter.

Example: Endpoints in Prometheus configuration file

remote_write:
  - url: "http://localhost:8086/api/v1/prom/write?db=prometheus"

remote_read:
  - url: "http://localhost:8086/api/v1/prom/read?db=prometheus"

Read and write URLs with authentication

If authentication is enabled on InfluxDB, pass the username and password of an InfluxDB user with read and write privileges using the u= and p= query parameters respectively.

Examples of endpoints with authentication enabled**_
remote_write:
  - url: "http://localhost:8086/api/v1/prom/write?db=prometheus&u=username&p=password"

remote_read:
  - url: "http://localhost:8086/api/v1/prom/read?db=prometheus&u=username&p=password"

Including plain text passwords in your Prometheus configuration file is not ideal. Unfortunately, environment variables and secrets are not supported in Prometheus configuration files. See this Prometheus issue for more information:

Support for environment variable substitution in configuration file

How Prometheus metrics are parsed in InfluxDB

As Prometheus data is brought into InfluxDB, the following transformations are made to match the InfluxDB data structure:

  • The Prometheus metric name becomes the InfluxDB measurement name.
  • The Prometheus sample (value) becomes an InfluxDB field using the value field key. It is always a float.
  • Prometheus labels become InfluxDB tags.
  • All # HELP and # TYPE lines are ignored.
  • [v1.8.6 and later] Prometheus remote write endpoint drops unsupported Prometheus values (NaN,-Inf, and +Inf) rather than reject the entire batch.

Example: Parse Prometheus to InfluxDB

# Prometheus metric
example_metric{queue="0:http://example:8086/api/v1/prom/write?db=prometheus",le="0.005"} 308

# Same metric parsed into InfluxDB
measurement
  example_metric
tags
  queue = "0:http://example:8086/api/v1/prom/write?db=prometheus"
  le = "0.005"
  job = "prometheus"
  instance = "localhost:9090"
  __name__ = "example_metric"
fields
  value = 308

In InfluxDB v1.5 and earlier, all Prometheus data goes into a single measurement named _ and the Prometheus measurement name is stored in the __name__ label. In InfluxDB v1.6 or later, every Prometheus measurement gets its own InfluxDB measurement.

This format is different than the format used by the Telegraf Prometheus input plugin.


Was this page helpful?

Thank you for your feedback!


Set your InfluxDB URL

Linux Package Signing Key Rotation

All signed InfluxData Linux packages have been resigned with an updated key. If using Linux, you may need to update your package configuration to continue to download and verify InfluxData software packages.

For more information, see the Linux Package Signing Key Rotation blog post.

InfluxDB Cloud backed by InfluxDB IOx

All InfluxDB Cloud organizations created on or after January 31, 2023 are backed by the new InfluxDB IOx storage engine. Check the right column of your InfluxDB Cloud organization homepage to see which InfluxDB storage engine you’re using.

If powered by IOx, this is the correct documentation.

If powered by TSM, see the TSM-based InfluxDB Cloud documentation.

InfluxDB Cloud backed by InfluxDB TSM

All InfluxDB Cloud organizations created on or after January 31, 2023 are backed by the new InfluxDB IOx storage engine which enables nearly unlimited series cardinality and SQL query support. Check the right column of your InfluxDB Cloud organization homepage to see which InfluxDB storage engine you’re using.

If powered by TSM, this is the correct documentation.

If powered by IOx, see the IOx-based InfluxDB Cloud documentation.

State of the InfluxDB Cloud (IOx) documentation

The new documentation for InfluxDB Cloud backed by InfluxDB IOx is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.