aws-samples / aws-batch-runtime-monitoring

Serverless application to monitor an AWS Batch architecture through dashboards.
MIT No Attribution
56 stars 16 forks source link

Failure in Adding Monitoring to Existing Auto-Scaling Groups #9

Open zalex5 opened 2 years ago

zalex5 commented 2 years ago

Hi, if you have Null values in some "LaunchTemplateName" fields then you get the following error when trying to add Existing Auto-Scaling Groups to the monitoring: jq: error (at <stdin>:6896): null (null) and string ("Batch-lt") cannot have their containment checked

A possible workaround could be: aws autoscaling describe-auto-scaling-groups | jq -c '.AutoScalingGroups[] | select( .MixedInstancesPolicy.LaunchTemplate.LaunchTemplateSpecification.LaunchTemplateName != null) |select(.MixedInstancesPolicy.LaunchTemplate.LaunchTemplateSpecification.LaunchTemplateName | contains("Batch-lt")) | .AutoScalingGroupName' | xargs -t -I {} aws autoscaling enable-metrics-collection --metrics GroupInServiceCapacity GroupDesiredCapacity GroupInServiceInstances --granularity "1Minute" --auto-scaling-group-name {} (this command would replace the one in the readme.md)

Regards

aorcl commented 7 months ago

As an alternative, enabling the monitoring can be done manually for the desired autoscaling groups in the AWS console:

image