Skip to main content

Variables

The topic of variables in Grafana has generated a myriad of questions lately. In short, there are three types of variables.

  • Dashboard
  • Global
  • Environment
Three logical layers and their corresponding variable.
Three logical layers and their corresponding variable.

Dashboard, Global and Environment variables

We created this video to structure the subject and speed up the learning curve for Grafana enthusiasts.

Dashboard, Global and Environment variables.

Dashboard variables

Dashboard variables capture the values within one dashboard. They are usually used for filter functionality.

Types of Grafana dashboard variables.
Types of Grafana dashboard variables.

Global variables

Global variables are Grafana settings you can retrieve and use on your dashboards.

VariableDescription
${__dashboard}Name of the current dashboard.
${__from}From of Time Range in epoch milliseconds.
${__interval}Parameter to group by time.
${__org.name}Name of the current organization.
${__org}Id of the current organization.
${__to}To of Time Range in epoch milliseconds.
${__user.email}Email for the current user.
${__user.id}Id of the current user.
${__user.login}Login handle of the current user.

You can find all the global built-in variables in the Grafana documentation.

Environment variables

Environment variables are the variables from the Grafana environment (operating system and/or device) where Grafana is installed.

Conventionally those variables are off-limits, but with the Environment data source, access to the environment variables is possible!

Environment Variables for Configuration, Provisioning, and Dashboards in Grafana.
Environment Variables for Configuration, Provisioning, and Dashboards in Grafana.

Grafana variables at a glance, Environment data source explained

The following blog post provides more information about variable types with examples.

Grafana variables at a glance, Environment data source explained.
Grafana variables at a glance, Environment data source explained.