Two datasources one variable as input


I have dashboard where data comes from InfluxDB and graphite. For both I have variable to choose the input VM.

I would like to use one variable for both. Datasources provide different metrics, but they are related, same site.

InfluxDB site names are like this: SITE1, SITE2, SITE3
grphite sites are: site1, ste2, site33

Meaning they are similar, but not the same and I can’t match them in queries or filter with regex.

I tried creating custom variable.
Like this:

“selected”: true,
“text”: “SITE1”,
“value”: “SITE1-site1”
“selected”: false,
“text”: “SITE2”,
“value”: “SITE2-ste2”
“selected”: false,
“text”: “SITE3”,
“value”: “SITE3-site33”

So the idea would be that the custom one is the main, that the user sees. Based on the selection it would select corresponding influxDB and graphite site variable and display metrics.

Hope I was clear.

Any ideas?

It looks like a task for case insensitive InfluxDB regexp. E.g. you will use graphite value in InfluxDB regexp:

WHERE "tag" =~  /(?i)^$sitevariable$/


Thanks, but the case sensitivity is not the case always. Like when the InfluxDB variable is “THIS-IS-SITE1” and corresponding graphite site is “tis1” What is the idea then?

i thought that, if I have third custom variable, with values SITE1-tis1. How can I use this in regex? So it would check only part of the value. Currently it checks all and does not match.

Trying to sum up. There are 2 list of variables(datasources)
Influx graphite

SITE1-OS ste1
SITE2-EL site2el
SITE3 stge

My idea was that I will create custom variable, where the value is combined from both, like this:

User would select from that list. And based on the selection grafana would match influx and graphite variables.

Is is possible? How I should do it?

How is filtering done if I influx query value is SITE1-OS and corresponding value in the custom one is SITE1-OS|ste1. It currently compares the whole string, but can I get it to check part of the string?

Then create measurement, where you define custom relations and use it as it is described in: