Documentation

Use dynamic values in configurations

Telegraf Controller is in Private Alpha

Telegraf Controller is in private alpha. If you are interested in being a part of the private alpha program, please sign up:

Sign Up for the Alpha

While in alpha, 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.

Use dynamic values in your Telegraf configurations and reuse a single configuration for multiple distinct agents or across environments.

Telegraf Controller supports the following dynamic value types:

  • Parameters for values you want to set or override per agent.
  • Environment variables for values provided by the running Telegraf agent.
  • Secrets for sensitive values stored in an external secret store.

Parameters

Use parameters for values that change between agents, deployments, or environments. Define the parameter where the configuration is easy to find, and then reference it in plugin settings. Configuration parameters are a feature of Telegraf Controller and are not part of the Telegraf project.

Do not use parameters for sensitive information

Do not use parameters to provide sensitive information in agent configurations. Parameter values are passed over the network. Use environment variables or secrets to provide sensitive information to agents.

Use the following syntax:

&{param_name[:default_value]}

Parameters do not require a default value. Any parameter without a default value is considered required and must be defined when requesting the configuration from Telegraf Controller.

Use parameters in Telegraf configurations

[[outputs.influxdb_v2]]
  # Parameter with a default value
  urls = ["&{db_host:https://localhost:8181}"]

[[outputs.heartbeat]]
  # Required parameter without a default value
  instance_id = "&{agent_id}"

The example above uses two parameters:

  • db_host with a default value of https://localhost:8181
  • agent_id (Required)

Define parameters

Use URL-encoded query parameters to define parameter values when requesting a configuration’s TOML. The Telegraf Controller API returns the TOML with replaced parameters.

For readability, the following example uses Shell variables to build the configuration URL with query parameters for each configuration parameter:

configUrl="http://localhost:8888/api/configs/xxxxxx/toml"
params="?db_host=https%3A%2F%2Fmydomain%3A8181"
params+="&agent_id=agent123"
configUrl+=$params

telegraf \
  --config $configUrl

If requesting the example configuration above, Telegraf would load the following TOML configuration:

[[outputs.influxdb_v2]]
  # Parameter with a default value
  urls = ["https://mydomain:8181"]

[[outputs.heartbeat]]
  # Required parameter without a default value
  instance_id = "agent123"

Environment Variables

Use environment variables for values that Telegraf reads from the agent environment at runtime. Provide a default to keep the configuration portable across environments.

Use the following syntax:

${VAR_NAME[:-default_value]}

Environment variables do not require a default value. Any environment variable without a default value is considered required and must be defined in the Telegraf agent’s environment when using the configuration.

For more information about Telegraf environment variable syntax, see Telegraf configuration options—Set environment variables.

Use environment variables in Telegraf configurations

[[inputs.http]]
  urls = ["${API_ENDPOINT:-http://localhost:8080}/metrics"]

  [inputs.http.headers]
    Authorization = "Bearer ${AUTH_TOKEN}"

The example above uses two environment variables:

  • API_ENDPOINT with a default value of http://localhost:8080
  • AUTH_TOKEN (Required)

Define environment variables at runtime

Telegraf loads environment variables from the agent runtime environment.

API_ENDPOINT=https://mydomain.com/metrics
AUTH_TOKEN=x00x0xx00xxxX0xXXx0000xxxX000x00XXxXx

telegraf \
  --config "http://localhost:8888/api/configs/xxxxxx/toml"

Secrets

Use secrets for credentials or tokens you do not want to store in plain text. Secrets require a secret store and its corresponding secretstores plugin.

# Configure a secret store plugin
[[secretstores.vault]]
  id = "my_vault"
  address = "my_vault:8200"
  token_file = "/path/to/auth/token"
  # ...

# Use secrets from the configured secret store
[[outputs.influxdb_v2]]
  host = "my_influxdb.com:8181"
  token = "@{my_vault:influx_token}"

For more information about Telegraf secrets and secret stores, see Telegraf configuration options—Secret stores.

When using secrets:

  • Configure the secret store plugin in the same configuration.
  • Use a stable id so references to a secret store remain consistent.
  • Ensure the Telegraf agent can reach and authenticate with the secret store.

Was this page helpful?

Thank you for your feedback!


New in InfluxDB 3.8

Key enhancements in InfluxDB 3.8 and the InfluxDB 3 Explorer 1.6.

See the Blog Post

InfluxDB 3.8 is now available for both Core and Enterprise, alongside the 1.6 release of the InfluxDB 3 Explorer UI. This release is focused on operational maturity and making InfluxDB easier to deploy, manage, and run reliably in production.

For more information, check out:

InfluxDB Docker latest tag changing to InfluxDB 3 Core

On February 3, 2026, the latest tag for InfluxDB Docker images will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments.

If using Docker to install and run InfluxDB, the latest tag will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments. For example, if using Docker to run InfluxDB v2, replace the latest version tag with a specific version tag in your Docker pull command–for example:

docker pull influxdb:2