I have defined a variable in a Grafana dashboard through Grafana dashboard settings Variable is of "Custom" type. I want this variable having a default value when dashboard is opened.
How can I set a default value ?
I have defined a variable in a Grafana dashboard through Grafana dashboard settings Variable is of "Custom" type. I want this variable having a default value when dashboard is opened.
How can I set a default value ?
If you'd like to avoid ClickOps by interacting with Grafana UI to persist config changes, then you can modify Grafana's dashboard JSON model - this will allow you to share your dashboard.
Let's say that you have defined your custom variable (like on the image below), and you would like to set 1[m]
as a default value.
Then what you should do next, is to find this variable definition in Grafana's dashboard JSON model (look at templating.list
location) and set "selected"
to true
in "options"
and add/modify "current"
section. Your config should resemble below settings.
...
"current": {
"selected": true,
"text": "1m",
"value": "1m"
},
"options": [
{
"selected": true,
"text": "1m",
"value": "1m"
},
{
"selected": false,
"text": "3m",
"value": "3m"
},
...
],
...