More complex templating var to determine server names by role

Hi, I’m trying to create a templating variable that provides a list of the server names based on a role that’s defined in the series name.

My metrics are of the form

collectd..my.lab.group..metric

where role would be something like role_a or role_b for example.

What I tried was
collectd.*.my.lab.group.role_a.metric
…but this just returns the last component of the series not the wildcard component. I’d like a way to create a template variable for role_a and another for role_b and then uses these within the relevant dashboards.

With influxdb as a backend this is simple - show series + regex, but I’m struggling with graphite as a backend to achieve the same thing

Is this possible, or am I going about it the wrong way?

Any help appreciated!

Environment:
grafana 4.3.1
graphite data source (0.9.15)

There is an open feature request to return non leaf nodes in Graphite template queries.

Thanks for the speedy reply!

At least I’m not going mad…

Maybe I could update the variables automatically through the dashboard API. For example, GET the dashboard, which will give me the equivalent of an export, then parse/update it and POST it back. Could be a cron type thing.

Does that sound like a reasonable alternative…at least until the open feature request you mentioned is addressed ?

BTW, what’s the issue number for the feature request you mentioned…I couldn’t find it :frowning:

Thanks!