Use InfluxDB 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.
When attempting to access the community templates via the URL, the templates use the following as the root of the URL:
For example, the Docker community template can be accessed via:
https://raw.githubusercontent.com/influxdata/community-templates/master/docker/docker.yml
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>
# Example
influx template -f /path/to/template.yml
# Syntax
influx template -u <FILE_URL>
# Example
influx template -u https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.yml
To validate a template before you install it or troubleshoot a template, use the . Validate a template stored in your local filesystem or from a URL.
# Syntax
# Example
influx template validate -u https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.yml
Use the influx apply command to install templates from your local filesystem or from URLs.
- Apply all templates in a directory
- Apply templates from both files and URLs
- Include a secret when installing a template
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.
To install templates stored on your local machine, use the -f
or --file
flag to provide the file path of the template manifest.
# Syntax
influx apply -o <INFLUX_ORG> -f <FILE_PATH>
# Examples
# Apply a single template
influx apply -o example-org -f /path/to/template.yml
# Apply multiple templates
influx apply -o example-org \
-f /path/to/this/template.yml \
-f /path/to/that/template.yml
Apply all templates in a directory
# Syntax
influx apply -o <INFLUX_ORG> -f <DIRECTORY_PATH>
# Examples
# Apply all templates in a directory
influx apply -o example-org -f /path/to/template/dir/
# Apply all templates in a directory and its subdirectories
To apply templates from a URL, use the -u
or --template-url
flag to provide the URL of the template manifest.
Apply templates from both files and URLs
To apply templates from both files and URLs in a single command, include multiple file or directory paths and URLs, each with the appropriate -f
or -u
flag.
# Syntax
influx apply -o <INFLUX_ORG> -u <FILE_URL> -f <FILE_PATH>
influx apply -o example-org \
-u https://example.com/templates/template1.yml \
-u https://example.com/templates/template2.yml \
-f ~/templates/custom-template.yml \
-f ~/templates/iot/home/ \
--recurse
Some templates include that let you provide custom resource names. The influx apply
command prompts you to provide a value for each environment reference in the template. You can also provide values for environment references by including an --env-ref
flag with a key-value pair comprised of the environment reference key and the value to replace it.
influx apply -o example-org -f /path/to/template.yml \
--env-ref=bucket-name-1=myBucket
--env-ref=label-name-1=Label1 \
--env-ref=label-name-2=Label2
Include a secret when installing a template
Some templates use 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.
# Syntax
influx apply -o <INFLUX_ORG> -f <FILE_PATH> \
--secret=<secret-key>=<secret-value>
# Examples
# Define a single secret when applying a template
influx apply -o example-org -f /path/to/template.yml \
--secret=FOO=BAR
# Define multiple secrets when applying a template
influx apply -o example-org -f /path/to/template.yml \
--secret=BAZ=quz
To add a secret after applying a template, see Add secrets.