Templates and variables

    Variables allow you to create more interactive and dynamic dashboards. Instead of hard-coding things like server, application, and sensor names in your metric queries, you can use variables in their place. Variables are displayed as dropdown lists at the top of the dashboard. These dropdowns make it easy to change the data being displayed in your dashboard.

    These can be especially useful for administrators who want to allow Grafana viewers to quickly adjust visualizations but do not want to give them full editing permissions. Grafana Viewers can use variables.

    A template is any query that contains a variable.

    For example, if you were administering a dashboard to monitor several servers, you could make a dashboard for each server. Or you could create one dashboard and use panels with template queries like this one:

    Variable values are always synced to the URL using the syntax .

    Variables are listed in drop-down lists across the top of the screen. Select different variables to see how the visualizations change.

    To see variable settings, navigate to Dashboard Settings > Variables. Click a variable in the list to see its settings.

    Variables can be used in titles, descriptions, text panels, and queries. Queries with text that starts with $ are templates. Not all panels will have template queries.

    • Put the variables that you will change often at the top, so they will be shown first (far left on the dashboard).