Skip to content

Add Environmental Variable To Fetch Config from URL #8909

@EnochPrime

Description

@EnochPrime

Feature Request

Allow for fetching a configuration file from a URL set by an environmental variable.

Proposal:

Add a new variable, such as TELEGRAF_CONFIG_URL, that will parse a configuration file from a URL.

New order for finding config file:

  1. -config
  2. $TELEGRAF_CONFIG_URL
  3. $TELEGRAF_CONFIG_PATH
  4. $HOME/.telegraf/telegraf.conf
  5. /etc/telegraf/telegraf.conf

Current behavior:

The -config option allows for either a URL or a file path and the TELEGRAF_CONFIG_PATH only allows a file path.

Desired behavior:

Fetch a configuration from a URL when set by TELEGRAF_CONFIG_URL.

Use case:

When setting up an InfluxDB and Telegraf stack using docker-compose the -config switch cannot be used. Therefore, an environmental variable that can resolve the URL is required.

Example:

  telegraf:
    image: telegraf:1.17.2
    environment:
      - TELEGRAF_CONFIG_URL="http://influxdb.local:8096/api/v2/telegraf/0000000000000000"
      - INFLUX_TOKEN=/run/secrets/INFLUX_TOKEN

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions