Multiple template variables in a single metric path

Hi,

I am trying to use multiple template variables in a single metric query path. The datasource is Graphite.

My whisper file looks like: indices_artifact-11_english_total_merges_total-size.wsp and I have split out the index name and metric name into template variables with regexes. The index name and index metric name populate into the template variable dropdown fine, but attempting to access them in a single query path (or box) yields nothing (no error). I did have it working yesterday but my query got blown away so it should work (because I know it has). I also understand that I may be on the edge of supported functionality. If anyone has done something similar, I would appreciate some advice.

Currently, the query looks like this, where the $index would be artifact-11_english and $indexname would be total_merges_total-size

servers.elasticsearch.$host.elasticsearch.$cluster.gauge.indices_$index_$indexmetric

You can use the alternative [[varname]] for this use case

This does not seem to change the behavior at all. I’m assuming you mean my full query would simply change to:

servers.elasticsearch.$host.elasticsearch.$cluster.gauge.indices_[[index]]_[[indexmetric]]

I am getting the select metric box pop up indicating that it is not finding the metric properly. Got any other tricks I can try?

So it looks like just one template variable works but two does not.

I can do
servers.elasticsearch.$host.elasticsearch.$cluster.gauge.indices_[[index]]_total_merges_total-size

But this does not work still:
servers.elasticsearch.$host.elasticsearch.$cluster.gauge.indices_[[index]]_[[indexmetric]]

Strange, no one has had any issues with that syntax before, using multiple in same metric path, try changing all to alternative syntax

@torkel that does not seem to help either. My regex must not be fully correct (maybe a whitespace issue?). Unfortunately the plugin I am using does not split index metrics into appropriate pathing (i.e. ...indices.$index.$indexmetric).

I’m running into this issue as well … no combination of [[varname]] or $varname works with underscores.

Trying to do something like this
icinga2.$component-$deployment$-$number_$environment$_$ec2region.services.check_cpu.check_cpu.perfdata.USER.value

Everything works up to and after the underscores. I’ve tried [[varname]] as well and it doesn’t work. Query inspection looks something like this:
data:“target=icinga2.%7Bwebapi%7D-beta%24-%24number_%7Bprod%7D%24_%24ec2region.services.check_cpu.check_cpu.perfdata.USER.value&from=-6h&until=now&format=json&maxDataPoints=1908”

Running: Grafana v4.5.2 (commit: ec2b0fe)

Thanks!

I’m also seeing the same issue using Hosted Graphite. It stops seeing metrics beyond hyphens for me. I’ve tried $varname and [[varname]] with hyphens in between, asterisks in between, and mixtures of them all and I can’t seem to get it to work.

To update this it appears, using inspect network options, the variables are being given curly brackets and this is why it’s not working:

render?target=currentAbove(aws..alb.eu-west-1.inst.app.%7Bsgb%7D-%7Bprod%7D.....*.UnHealthyHostCount%2C%200.1)&from=-24h&until=now&format=json&maxDataPoints=1912

A different graph with 3 variables put together the same way is not rendering with the curly brackets. Query with variables is:

aliasByNode(servers.$Client-$Environment-$Instance.rabbitmq.queues.$Queue.messages_ready, 1, 4)

And inspect shows the first two variables being rendered correctly (in bold below):

render?target=aliasByNode(servers.hermes-prod-%7Brabbitmqha-01%2Crabbitmqha-02%2Crabbitmqha-03%2Crabbitmqha-04%2Crabbitmqha-05%2Crabbitmqha-06%2Crabbitmqha-07%2Crabbitmqha-08%2Crabbitmqha-09%7D.rabbitmq.queues.%7Bamq%2Cbatch-created%2Cbatch-created-item%2Cbatch-created-link%2Cbatch-created-list%2Cbatch-created-lookupList%2Cchange-events-queue%2Cffiq%2Clookuplist-created-etl-org-batch%2Clookuplist-created-mm%2Clookuplist-created-rtm%2Clookuplist-created-rtmme%2Cmi-activity-created%2Cmi-drop-created%2Cmi-drop-state-created%2Cmi-item-created%2Cmi-item-created-staging%2Cmi-item-state-created%2Cmi-item-state-created-parked%2Cmi-item-state-created-staging%2Cmi-link-created%2Cmi-list-created%2Cmi-list-state-created%2Cmi-resource-state-created%2Corgservice-updated-rtm%2Corgservice-updated-rtmme%2Cretry-service%2Crtmservice-updated-rtmme%2Ctest%2Ctrade-notification%2Ctrade-notification-queue%2Cupdate-queue%7D.messages_ready%2C%201%2C%204)&from=-1h&until=now&format=json&maxDataPoints=638

This has been resolved from changing the regex to a different format to collect the same information. It then started rendering the query successfully. When I revert the regex back to the old format, it is still working!

Have no idea what caused this or how it was fixed :slight_smile: