How to use prefixed dimension values with wildcard or variable with AWS Cloudwatch data source?


we have had a working dashboard using an AWS Cloudwatch data source and it stopped working with the changes introduced in grafana 6.5. I’ve been trying to figure out ways to change our dashboard to get it working the way it was before to no avail.

The dashboard queries look like this:

Before 6.5 the resulting graph shows queue sizes for each customer selected in the variable $customer. Starting with 6.5 it doesn’t show anything anymore.

Then I tried to use a wildcard: QueueName = incident_store_*
That doesn’t work either.

When using QueueName = incident_store_actualcustomer it shows that customers graph, but that’s not a good solution as our customer list changes dynamically.

Then I tried to use an unprefixed wildcard: QueueName = *. That works, but we have many queues with different prefixes and we get a “Maximum Number of allowed metrics exceeded error” when the query runs, also we mix all kinds of queues that we don’t want to mix.

I went directly to CloudWatch to see what the query would need to look like to get at least QueueName = incident_store_* to work.
The query that works in CloudWatch shows:
SEARCH('{AWS/SQS,QueueName} MetricName="ApproximateNumberOfMessagesVisible" QueueName=incident_store_*', 'Maximum', 60)

It includes an additional QueueName in the first parameter. Is there any way to get grafana to come up with a query like that or to be able to write my own query by hand?

I hope this question makes soem sense, I’ll gladly supply additional info if needed.

Thank you very much!

Hey did you have any luck figuring out how to wildcard with a prefix? Same thing here, our resource names are dynamic so we need a way to target them generically.

After trying something , i could be able to do with the variable option.

created a variable in the grafana dashboard ( Since i dont want to display dev,qa,testing queues i used regex in the variable )

(Since i don’t want to display the variable in the grafana, i disabled it and i made sure “Multiple values” and “Include All options are selected , so by default All options is selected”

And in the query i have selected Template variable for the QueueNames

But one drawback with this option is we can’t set the alarm/alert because , Grafana doesn’t support Template variables in alert queries

1 Like

Isn’t working for me, the query works fine but when i add it to the queuname dimension i just get one of the multiple variables