Time Range Template

Warning! This page documents an old version of Chronograf, which is no longer actively developed. Chronograf v1.3 is the most recent stable version of Chronograf.

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