Templating to allow grouping servers by function



I’m struggling a bit with templating, I cannot find a way to properly group my servers so that the same panels do not get duplicated.

Let’s say I have web servers and db servers, websrv0[123] and dbsrv0[1234] .

I would need a variable that would either allow displaying of all websrv* or dbsrv* . What is being displayed (metrics) does not matter so far; I want to be able to select which server group is displayed in the panel, from a drop-down menu.

How should I go to build the query-ies ?

Using Grafana 4.1.2 with Graphite and Collectd.



I’m also very new to grafana templating and have a quite similar question, so hopefully both can be answered here.

I have installed telegraf on several servers including some running Windows. I have a “Detailed Server” dashboard using a template variable to determine the server names, but I want to restrict to only those submitting “win_cpu” measurements (i.e. the Windows boxes), and have another template variable to determine the non-Windows boxes (e.g. submitting “cpu” measurements).

I thought there should be a way to define the template variable as:

show tag values with key = “host” where “measurement” = “win_cpu”

(but this doesn’t work). I’m sure this is something trivial I’m not understanding about the query syntax.