I have 2 template variables, for example assume it as region, instanceid. All the regions and instance id are listed if i click on the dropdown it shows all values. I want to create a dashboard in grafana with two pannels to show how many regions and instanceid are there in that variable by cloudwatch as a datasource, how can i achieve this
What queries did you use to create the list of available choices in each template variable? Can you paste here?
Hi @grant2, i am using cloudwatch as a datasource, and i have added multiple template variables, i am actually fetching the resource with tags and with query resource_arn, the below are the variables i have used,
– ec2_instance_attribute($region, Tags.Name, {})
– resource_arns($region,elasticloadbalancing:loadbalancer,{“Name”:[“$instancename”]})
– resource_arns($region,rds:db,{“Name”:[“$instancename”]})
– resource_arns($region,autoscaling:autoscalinggroup,{“Name”:[“$instancename”]})
I can see the template variables created now. I have 2 requirements now
-
How do i calculate the number of asg, rds, lb with that tag name. Basically i just want to count how many ever is listed in template variable.
-
can i add this query in grafana pannel instead of template variables and add count. If possible please suggest how could this be done
Thanks
Hi @jangaraj
I have tagged few resources and I would like to fetch only my tagged resources. For example I have tagged key as ‘env‘ and value as ‘prod’. So in the Grafana panel, I would like to fetch only the rds with this particular tag.
Got it. Use Cloudwatch math. Query 1 will return some metrics per resource (e. g. avg CPU utilization per EC2 per selected dashboard time range) and then use expression to count those values from query 1.
Hi @jangaraj,Sorry I didnt get that right. So how can we filter based on the tags here?
@jangaraj With the sample which you have mentioned i couldnt get the count of lambda functions. Meaning i want to fetch the count of lambda functions with Tag as env…
If this is not possible by Namespace, please suggest if i can use ‘resource_arns’ query somehow in the grafana pannel


