Time Range Template

This is archived documentation for InfluxData product versions that are no longer maintained. For newer documentation, see the latest InfluxData documentation.

The following sections will show you how to create time range template on a graph. If you’d like to follow along, see Getting Started with Telegraf to get the data we use in this section.

Template time range with tmplTime()

Use the tmplTime() function to create a template variable that controls the query’s time range. This works for queries that use the query builder as well as manually entered queries.

Example:

Once you enter the query below, you can select alternative time ranges by clicking on the dropdown in the top right corner.

Query:

SELECT usage_idle FROM "telegraf"."default"."cpu" WHERE tmplTime()

Chronograf visualization with a time template variable:

Time template