Zabbix template variables
Template variables let you create dynamic, reusable dashboards that switch between host groups, hosts, applications, and items without editing the dashboard. You can populate variable drop-downs with values from Zabbix and reference those variables in queries, panel titles, and text panels.
Before you begin
Supported variable types
Create a query variable
To create a variable that fetches values from Zabbix:
- Open a dashboard and click Dashboard settings (gear icon).
- Click Variables in the left menu.
- Click Add variable.
- Set Variable type to Query.
- Select the Zabbix data source.
- Select a Query Type and fill in the filter fields.
- Click Apply.
Query types
The variable query editor uses a structured form with a Query Type drop-down. Select the type of Zabbix entity you want to populate the variable with.
All filter fields support regex patterns (for example, /.*/ to match all values) and references to other template variables (for example, $group).
For the Item and Item values query types, the editor shows either Application (Zabbix < 5.4) or Item Tag (Zabbix 5.4+) depending on your Zabbix server version. Only one field is visible at a time.
When the Item query type is selected, you can also toggle Show disabled items to include disabled items in the results.
Legacy query format
Older dashboards may use a legacy string-based query format. The Zabbix variable editor displays these as a read-only Legacy Query field and automatically converts them to the structured format.
The legacy format uses four parts wrapped in braces:
{host group}{host}{application}{item name}Each part can be a specific name or * (all values). The number of parts determines what the variable returns:
Use variables in queries
Reference variables in the query editor by prefixing the variable name with $. For example, if you have a variable named host, use $host in the Host field of a Metrics query.
Variables work in most query editor fields, including:
- Group, Host, Application / Item tag, Item
- Service, SLA
- Proxy, Problem, Item Ids, Macros
- Panel and row titles
- Text panel content
Note
When using multi-value variables, the plugin automatically formats the selected values as a regex pattern for Zabbix API queries.
Chain variables
You can reference one variable inside another variable’s query to create cascading drop-downs. For example:
- Create a variable named
groupwith Query Type set to Group. - Create a variable named
hostwith Query Type set to Host and set the Group field to$group. - Create a variable named
itemwith Query Type set to Item, set Group to$group, and Host to$host.
When you change the group selection, the host variable automatically updates to show only hosts in that group, and the item variable updates accordingly.



