Documentation

Configure Telegraf for InfluxDB

Use the Telegraf influxdb_v2 output plugin to collect and write metrics to InfluxDB Clustered. Learn how to enable the plugin in new and existing Telegraf configurations, and then start Telegraf using the custom configuration file.

View the requirements for using Telegraf with InfluxDB Clustered.

Configure Telegraf input and output plugins

Configure Telegraf input and output plugins in the Telegraf configuration file (typically named telegraf.conf). Input plugins collect metrics. Output plugins define destinations where metrics are sent.

This guide assumes you followed Setup instructions in the Get Started tutorial to set up InfluxDB and configure authentication credentials.

Add Telegraf plugins

To add any of the available Telegraf plugins, follow the steps below.

  1. Find the plugin you want to enable from the complete list of available Telegraf plugins.
  2. Click View to the right of the plugin name to open the plugin page on GitHub. For example, view the MQTT plugin GitHub page.
  3. Copy and paste the example configuration into your Telegraf configuration file (typically named telegraf.conf).

Enable and configure the InfluxDB v2 output plugin

To send data to InfluxDB Clustered, enable the influxdb_v2 output plugin in the telegraf.conf.

[[outputs.influxdb_v2]]
  urls = ["https://cluster-host.com"]
  # INFLUX_TOKEN is an environment variable you created for your database WRITE token

  token = "${INFLUX_TOKEN}"
  organization = ""
  bucket = "
DATABASE_NAME
"

Replace the following:

  • DATABASE_NAME: the name of the InfluxDB database to write data to

The InfluxDB output plugin configuration contains the following options:

urls

An array of URL strings. To write to InfluxDB Clustered, include your InfluxDB cluster URL using the HTTPS protocol:

["https://cluster-host.com"]
token

Your InfluxDB Clustered database token with write permission to the database.

In the examples, INFLUX_TOKEN is an environment variable assigned to a database token that has write permission to the database.

organization

For InfluxDB Clustered, set this to an empty string ("").

bucket

The name of the InfluxDB Clustered database to write data to.

Write to InfluxDB v1.x and InfluxDB Clustered

If a Telegraf agent is already writing to an InfluxDB v1.x database, enabling the InfluxDB v2 output plugin will write data to both v1.x and your InfluxDB cluster.

Other Telegraf configuration options

influx_uint_support: supported in InfluxDB v3.

For more plugin options, see influxdb on GitHub.

Start Telegraf

Start the Telegraf service using the --config flag to specify the location of your telegraf.conf.

telegraf --config /path/to/custom/telegraf.conf

Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

InfluxDB v3 enhancements and InfluxDB Clustered is now generally available

New capabilities, including faster query performance and management tooling advance the InfluxDB v3 product line. InfluxDB Clustered is now generally available.

InfluxDB v3 performance and features

The InfluxDB v3 product line has seen significant enhancements in query performance and has made new management tooling available. These enhancements include an operational dashboard to monitor the health of your InfluxDB cluster, single sign-on (SSO) support in InfluxDB Cloud Dedicated, and new management APIs for tokens and databases.

Learn about the new v3 enhancements


InfluxDB Clustered general availability

InfluxDB Clustered is now generally available and gives you the power of InfluxDB v3 in your self-managed stack.

Talk to us about InfluxDB Clustered