Documentation

Use InfluxDB templates

Use the influx command line interface (CLI) to summarize, validate, and apply templates from your local filesystem and from URLs.

Use InfluxDB community templates

The InfluxDB community templates repository is home to a growing number of InfluxDB templates developed and maintained by others in the InfluxData community. Apply community templates directly from GitHub using a template’s download URL or download the template.

The community templates are under the following root URL:

https://raw.githubusercontent.com/influxdata/community-templates/master/
  • Copy
  • Fill window

For example, to access the Docker community template, use the following URL:

https://raw.githubusercontent.com/influxdata/community-templates/master/docker/docker.yml
  • Copy
  • Fill window

View InfluxDB Community Templates

View a template summary

To view a summary of what’s included in a template before applying the template, use the influx template command. View a summary of a template stored in your local filesystem or from a URL.

# Syntax
influx template -f <FILE_PATH>
  • Copy
  • Fill window
# Example
influx template -org ORG_NAME -f /path/to/templates/TEMPLATE_FILE.yml
  • Copy
  • Fill window
# Syntax
influx template -org <ORG_NAME> -u <FILE_URL>
  • Copy
  • Fill window
# Example
influx template -u https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.yml
  • Copy
  • Fill window

Validate a template

To validate a template before you install it or troubleshoot a template, use the influx template validate command. Validate a template stored in your local filesystem or from a URL.

# Syntax
influx template validate -org <ORG_NAME> -f <FILE_PATH>
  • Copy
  • Fill window
# Example
influx template validate -org ORG_NAME -f /path/to/templates/TEMPLATE_FILE.yml
  • Copy
  • Fill window
# Syntax
influx template validate -u <FILE_URL>
  • Copy
  • Fill window
# Example
influx template validate -u https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.yml
  • Copy
  • Fill window

Apply templates

Use the influx apply command to install templates from your local filesystem or from URLs. The default output is a summary of the template in “pretty” format and a prompt to confirm applying the changes.

# Syntax
influx apply \
 -o <INFLUX_ORG> \
 -f <FILE_PATH> \
 -u <URL> \
 --secret=<SECRET_KEY>=<SECRET_VALUE>
  • Copy
  • Fill window

Apply templates to an existing stack

To apply a template to an existing stack, include the stack ID when applying the template. Any time you apply a template without a stack ID, InfluxDB initializes a new stack and all new resources. For more information, see InfluxDB stacks.

You can extract a stack ID from the output of influx stacks and pass it to influx apply:

# Extract stack ID by name and apply a template to that stack
influx stacks | grep STACK_NAME | awk '{print $1}' | xargs -I{} influx apply -o ORG_NAME -f /path/to/TEMPLATE_FILE.yml --stack-id {}
  • Copy
  • Fill window

Apply a template from a file

To install templates stored on your local machine, use the -f or --file flag to provide the file path of the template manifest.

# Example
# Apply multiple templates
influx apply -o ORG_NAME \
  -f /path/to/templates/TEMPLATE_FILE_1.yml \
  -f /path/to/templates/TEMPLATE_FILE_2.yml
  • Copy
  • Fill window

To skip the confirmation and apply the templates non-interactively, pass --force yes:

# Download templates for tests
curl https://raw.githubusercontent.com/influxdata/community-templates/master/docker/docker.yml \
  -so /path/to/templates/TEMPLATE_FILE_1.yml &&
curl https://raw.githubusercontent.com/influxdata/community-templates/master/github/github.yml \
  -so /path/to/templates/TEMPLATE_FILE_2.yml &&
influx apply -o ORG_NAME \
  -f /path/to/templates/TEMPLATE_FILE_1.yml \
  -f /path/to/templates/TEMPLATE_FILE_2.yml \
  --force yes
  • Copy
  • Fill window

Apply all templates in a directory

To apply all templates in a directory, use the -f or --file flag to provide the directory path of the directory where template manifests are stored. By default, this only applies templates stored in the specified directory. To apply all templates stored in the specified directory and its subdirectories, include the -R, --recurse flag.

# Examples
# Apply all templates in a directory
influx apply -o ORG_NAME -f /path/to/templates/

# Apply all templates in a directory and its subdirectories
influx apply -o ORG_NAME -f /path/to/templates/ --recurse
  • Copy
  • Fill window

Apply a template from a URL

To apply templates from a URL, use the -u or --template-url flag to provide the URL of the template manifest.

# Example
# Apply multiple templates from URLs
influx apply -o ORG_NAME \
  -u https://raw.githubusercontent.com/influxdata/community-templates/master/docker/docker.yml \
  -u https://raw.githubusercontent.com/influxdata/community-templates/master/github/github.yml
  • Copy
  • Fill window

Apply templates from files and URLs

To apply templates from files and URLs in a single command, include multiple file or directory paths and URLs, each with the appropriate -f or -u flag.

# Example
influx apply -o ORG_NAME \
  -u https://raw.githubusercontent.com/influxdata/community-templates/master/raspberry-pi/raspberry-pi-system.yml \
  -u https://raw.githubusercontent.com/influxdata/community-templates/master/minio/minio.yml \
  -f /path/to/templates/TEMPLATE_FILE_1.yml \
  -f /path/to/templates/TEMPLATE_FILE_2.yml \
  --recurse
  • Copy
  • Fill window

Define environment references

Environment reference substitution not supported

This feature is not supported by InfluxDB Cloud.

Include a secret when installing a template

Some templates use secrets in queries. Secret values are not included in templates. To define secret values when installing a template, include the --secret flag with the secret key-value pair.

# Examples
# Define a single secret when applying a template
influx apply -o ORG_NAME -f /path/to/templates/TEMPLATE_FILE.yml \
  --secret=FOO=BAR

# Define multiple secrets when applying a template
influx apply -o ORG_NAME -f /path/to/templates/TEMPLATE_FILE.yml \
  --secret=FOO=bar \
  --secret=BAZ=quz
  • Copy
  • Fill window

To add a secret after applying a template, see Add secrets.


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 3 Core and Enterprise are now in Beta

InfluxDB 3 Core and Enterprise are now available for beta testing, available under MIT or Apache 2 license.

InfluxDB 3 Core is a high-speed, recent-data engine that collects and processes data in real-time, while persisting it to local disk or object storage. InfluxDB 3 Enterprise is a commercial product that builds on Core’s foundation, adding high availability, read replicas, enhanced security, and data compaction for faster queries. A free tier of InfluxDB 3 Enterprise will also be available for at-home, non-commercial use for hobbyists to get the full historical time series database set of capabilities.

For more information, check out:

InfluxDB Cloud powered by TSM