简体   繁体   中英

How do I add a condition to my Grafana link?

In my Grafana dashboard (with Prometheus as a data source), I have a custom $site variable, which allows the user to pick the site from a dropdown. It's defined as:

Values separated by comma: prod, preprod

With "Include All option" checked.

And then I have a link to my Kibana Dashboard in which I use this variable to pass the selected site as follow:

AND site:%20$site%20

When either prod or preprod are selected everything works great, here's what I get:

AND site: prod

Or

AND site: preprod

but when "all" is selected I endup with this:

AND site: {prod,preprod}

I want to add an if/else to the link template so that when "all" is selected what I get is:

AND (site: prod OR site: preprod)

Is that possible?

You can control the formatting of the variable interpolation using the advanced variable format options, described in the Grafana documentation here .

The option you're looking for is the "lucene" one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM