One Variable to set multiple Values


i currently try to create a Dashboard for multiple Locations.

My plan was to create one Dashboard for them all and choose the Location via Dropdown (CustomVariable Site=Site1,Site2).
This Dropdown should set 4 other values (If Site = Site1 then $server=siteserver*,$switch=site1switch …). This values i want to use as CustomVariables in Queries.

I’m not sure if my Question is clear.
If not, feel free to ask. I try to answer ASAP.

Thank you!

You can do queries with variables like this one (needs Grafana v5+)

SHOW TAG VALUES  WITH KEY = "Site" where servername =~ /^${Site}server*/


Thank you for your fast answer.

I’m a bit confused about “TAG”. Where did this come from?

AFAIK there ist no TAG or Site in Graphite.

The example is for InfluxDB + Grafana, but the it should also work for Graphite.

Maybe i’m wrong or we’re talking about different things, but a Query in my environment looks like this:
Name: serversite1
Query: icinga2.*
Regex: /^server1*|server2*|server3*|${site}server*/

Preview is: server1blabla server2blabla siteserverbla

I thought you want to use template variables

I want to setup Dashboards for different Sites filled with monitoring information from icinga2 (Carbon -> Graphite -> Grafana).
The easiest way is to setup one Dashboard and choose the location via dropdown.
I thought that would be “the way” to do it. If there is another way i’m happy to know it.
To build a own Dashboard for each location would become a mess.

I’m currently a bit frustrated. Not about Grafana itself. It looks nice and the configuration is cool. More about the combination of Grafana, Graphite and Carbon. I miss the Hostgroups from icinga, so i have to filter the hosts in another way. Which is very complex. Especially considering the future maintenance.

Also a simple If-Statement could help me so much.
if dropdown is set to Site1 choose this filter for Server, this filter for Switches, this filter for AccessPoints.
elif dropdown is set to Site2 choose this filter for Server, this filter for Switches, this filter for AccessPoints.

Maybe it’s a lag of the use of Graphite, i don’t know.

Thank you Carsten for trying to help me, but i think Grafana and me wouldn’t become friends.

If anyone have a great idea, i’m here.

You can also modify you host/service template for Graphite.

object GraphiteWriter "graphite" {
 host_name_template = "icinga2.$host.var.myvariable$.$$.host.$host.check_command$"

You have to makle sure that the host variable var.myvariable is always filled.
Iam not sure if the Graphite module for Icingaweb2 will work still with that change, but you can always use the Grafana module :slight_smile:


Good Idea, but i didn’t think that could work for me.
I would prefer when a Host can be in one or more groups/tags.

What do you think about InfluxDB?
Do i have more options to group hosts in Grafana?

Thank you!

With influxdb you can send any variable you want and as many as you want.

Forgot to tell you that you can also query the ido database for templating in grafana :slightly_smiling_face:

Currently i like it. :wink:

I added
hoststreet = “$host.vars.street$”
hostlocation = “$host.vars.location$”
hostcountry = “$$”
hostdevicetype = “$host.vars.devicetype$”
hostgroups = “$host.groups$”
to /etc/icinga2/features-enabled/influxdb.conf and it looks good.

For “hostgroups” i currently missing a “contains” filter. The rest will work fine

additional i changed in the icinga-file influxdb.conf the measurement of services to
Default is service.check_command, but i think it works better when i use
I have multiple services with the same check_command but with different names.

service_template = {
measurement = “$$”

Does anyone know if i get some problems with that?

Until now InfluxDb works really cool for me.
I have some trouble with “sumseries”, but i’m sure we (the community and me) find a good solution for it :wink:

Thank you for your help!

That didn’t work with my version.
Query: SHOW TAG VALUES WITH KEY = “hostgroups”
Regex: /site1/
Works fine for me.