This is documentation for the next version of Grafana. For the latest stable release, go to the latest version.
Add a constant variable
Constant variables allow you to define a hidden constant. This is useful for metric path prefixes for dashboards you want to share. When you export a dashboard, constant variables are converted to import options.
Constant variables are not flexible. Each constant variable only holds one value, and it cannot be updated unless you update the variable settings.
Constant variables are useful when you have complex values that you need to include in queries but don’t want to retype in every single query. For example, if you had a server path called
i-0b6a61efe2ab843gg, then you could replace it with a variable called
Enter General options
- Navigate to the dashboard you want to make a variable for and then click the Dashboard settings (gear) icon at the top of the page.
- On the Variables tab, click New.
- Enter a Name for your variable.
- In the Type list, select Constant.
- (optional) In Label, enter the display name of the variable dropdown. If you don’t enter a display name, then the dropdown label will be the variable name.
- Choose a Hide option:
- Variable - No variable dropdown is displayed on the dashboard. This is the default.
- No selection (blank) - The variable dropdown displays the variable Name or Label value.
- Label - The variable dropdown only displays the selected variable value and a down arrow.
Enter Constant options
- In the Value field, enter the variable value. You can enter letters, numbers, and symbols. You can even use wildcards if you use raw format.
- In Preview of values, Grafana displays the current variable value. Review it to ensure it matches what you expect.
- Click Add to add the variable to the dashboard.
Related Grafana resources
Be the first to learn about exciting next-generation features in Grafana 8.0, be inspired by what community members are building, and attend expert-led sessions and workshops on Grafana, Prometheus, Loki logs, and more.
Unify your data with Grafana plugins: Splunk, MongoDB, Datadog, and more
Show how Grafana can be used to take data from multiple different sources and unify it, without disrupting the investments that are working today.
Demo: Getting started with Grafana Enterprise and observability
Join the Grafana Labs team for a 30-minute demo of how to get started with the Grafana Stack, so you can go from zero to observability in just a few minutes.