cloudwatch_exporter icon indicating copy to clipboard operation
cloudwatch_exporter copied to clipboard

Unable to use aws_tag_select for Autoscaling group

Open ashishvaishno opened this issue 3 years ago • 1 comments

Hello,

I am trying to use aws_tag_select to select few asg's I have tried the below config

      - aws_namespace: AWS/AutoScaling
        aws_metric_name: GroupDesiredCapacity
        aws_dimensions: [ AutoScalingGroupName ]
        aws_statistics: [ Maximum ]
        aws_tag_select:
          tag_selections:
            Name: ["xxxxxxx"]
          resource_type_selection: "autoscaling:autoScalingGroup"
          resource_id_dimension: AutoScalingGroupName

I have replaced resource_type_selection with the below values and none of them worked for me

autoScaling:autoScalingGroup
autoScaling:autoScalingGroupName
autoScalingGroup:autoScalingGroupName
autoscaling:autoScalingGroup
autoscaling:autoScalingGroupName

Can you provide me some info , how to fetch the information?

Regards Ashish

ashishvaishno avatar Oct 28 '21 13:10 ashishvaishno

Unfortunately I am as lost as you are on this. From the service:resourceType format, based on the ARN format for autoscaling, I would expect autoscaling:autoScalingGroup to work, but apparently it does not.

This StackOverflow answer suggests that the resource groups tagging API does not support autoscaling, but this page lists it.

Maybe the problem is with something else? In the examples, the statistic is Average and not all metrics support all statistics.

matthiasr avatar Nov 26 '21 11:11 matthiasr

@ashishvaishno Have you tried putting everything lowercase in the resource type section? something like: autoscaling:autoscalinggroupname

JesusFrontelo avatar Feb 14 '23 08:02 JesusFrontelo

I managed to make it work like this:

aws_tag_select:
    resource_type_selection: "autoscaling"
    resource_id_dimension: AutoScalingGroupName

hope it helps

scaldarola avatar May 24 '23 13:05 scaldarola

Awesome, thank you!

matthiasr avatar Jun 02 '23 08:06 matthiasr

no results with

region: us-east-1
metrics:
- aws_dimensions:
  - AutoScalingGroupName
  aws_metric_name: GroupDesiredCapacity
  aws_namespace: AWS/AutoScaling
  aws_statistics:
  - Average
  aws_tag_select:
    tag_selections:
      Name: ["myasgname"]
    resource_type_selection: "autoscaling"
    resource_id_dimension: AutoScalingGroupName

ideas? Thanks

lukasmrtvy avatar Aug 15 '23 18:08 lukasmrtvy

Do you have a tag called Name? Some AWS objects (like EC2 instances) handle names that way, but it seems like ASGs have the name as a first-class parameter (as evidenced by the resource_id_dimension). What does

aws autoscaling describe-tags --filters 'Name=key,Values=Name'

give?

Should you be using aws_dimension_select instead, like

   aws_dimension_select:
     AutoScalingGroupName: [myasgname]

similar to the load balancer example?

matthiasr avatar Sep 25 '23 15:09 matthiasr