Use API tokens
Telegraf Controller is in Public Beta
Telegraf Controller is in public beta and will be part of the future Telegraf Enterprise offering. While in beta, Telegraf Controller is not meant for production use. The Telegraf Controller documentation is a work in progress, and we are actively working to improve it. If you have any questions or suggestions, please submit an issue. We welcome any and all contributions.
API tokens authenticate requests to Telegraf Controller. Use tokens to connect Telegraf agents, authorize heartbeat reporting, and integrate external API clients.
With Telegraf agents
Configure your Telegraf agent to include an API token when retrieving configurations and reporting heartbeats to Telegraf Controller.
Telegraf agents require API tokens with the following permissions:
- Configs: Read
- Heartbeat: Write
Use the INFLUX_TOKEN environment variable
When retrieving a configuration from a URL, Telegraf only sends an Authorization
when it detects the INFLUX_TOKEN environment variable. To authorize Telegraf
to retrieve a configuration from Telegraf Controller, define the INFLUX_TOKEN
environment variable:
export INFLUX_TOKEN=YOUR_TC_API_TOKEN
telegraf \
--config "http://telegraf_controller.example.com/api/configs/xxxxxx/tomlReplace YOUR_TC_API_TOKEN
with your Telegraf Controller API token.
For heartbeat requests
Telegraf uses the Heartbeat output plugin
to send heartbeats to Telegraf Controller.
Use the INFLUX_TOKEN environment variable to define the token option in your
heartbeat plugin configuration.
Telegraf uses the environment variable value defined when starting Telegraf.
[[outputs.heartbeat]]
url = "http://telegraf_controller.example.com/agents/heartbeat"
instance_id = "&{agent_id}"
interval = "1m"
include = ["hostname", "statistics", "configs"]
token = "${INFLUX_TOKEN}"When authentication is required for the heartbeat endpoint, agents must include a valid token with each heartbeat request. If a heartbeat request is missing a token or includes an invalid token, Telegraf Controller rejects the request and the agent’s status is not updated.
With external API clients
Include the token in the Authorization header when making API requests to
Telegraf Controller:
Authorization: Bearer tc-apiv1_<token>The token’s permissions determine which API endpoints and operations are accessible. Requests made with a token that lacks the required permissions are rejected with an authorization error.
If authentication is disabled for an endpoint group in Settings, requests to those endpoints do not require a token. See Settings for details on configuring authentication requirements per endpoint.
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Telegraf and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.