Variable updating issue


#1

We’re using Icinga2 to monitor our data centre and services and I have configured it to write to InfluxDB. I have created a Grafana dashboard where a user can choose a host, then select from the list of services that we monitor on that host and get an availability report.

The variables are:
$Host - SHOW TAG VALUES FROM “hostalive” WITH KEY = “hostname”
$Service - SHOW TAG VALUES WITH KEY=“service” WHERE hostname=’$Host’
$measurement - SHOW MEASUREMENTS WITH MEASUREMENT =~ /^.*/ WHERE service=’$Service’

It generally works well, the list of services updates when you select a host, except for when the selected hostname contains a dot. When you select a hostname that contains a dot the list of services does not update. If you know the name of the service you can type it in and get your dashboard.
It is also an issue when accessing the dashboard via a URL so for example going to https://grafana.mydomain.org/d/SV6TeKCiz/icinga-service-availability-influxdb?tab=queries&orgId=1&from=now-24h&to=now&refresh=15m&var-Host=host.mydomain.org&var-Service=host-https&var-measurement=check_https gives a broken dashboard which can be fixed by typing host-https into the Service box.

Does this sound like a Grafana bug?


#2

More investigation reveals that Grafana is escaping the dots with a backslash before sending the query to InfluxDB. InfluxDB does not like the backslashes.


#3

We have found a workaround by using the following for $Service:

SHOW TAG VALUES WITH KEY=“service” WHERE hostname=~ /^$Host$/