Skip to content

How to monitor 'Attempting to scale due to alarm triggered' causing 'AlreadyAtMaxCapacity' ?

0

I have under control more than 100 clusters.

I am fine tuning min and max capacity for each one to limit costs.

I am not able to find a way to monitor when a cluster cannot scale out due to 'AlreadyAtMaxCapacity' .

I cannot find also a measure to graph into a cloudwatch dashboard. How is it possibile I cannot graph the number of active tasks in my clusters?

2 Answers
0

There's an EventBridge Event for scaledToMax https://docs.aws.amazon.com/autoscaling/application/userguide/monitoring-eventbridge.html#event-example-1

You could put an SNS target on a Rule tracking this Event to be notified whenever it gets hit.

If you want a metric, you would need to have a Target for this Rule going to CloudWatch logs, and then have a Metric Filter push a metric whenever an Event comes in


For monitoring Task Count, each task in the RUNNING state uploads 1 datapoint, so you can roughly look at the SampleCount statistic for any Service level ECS metric to see how many running tasks there were at a given time https://docs.aws.amazon.com/AmazonECS/latest/developerguide/available-metrics.html#ecs-metrics-dimensions

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

-1

To monitor 'Attempting to scale due to alarm triggered' causing 'AlreadyAtMaxCapacity' across your multiple clusters, you can implement the following approach:

  1. Use Application Auto Scaling to monitor scaling activities. You can retrieve scaling activities, including those that result in 'AlreadyAtMaxCapacity', using the describe-scaling-activities command. To include activities where scaling did not occur, add the --include-not-scaled-activities option to your command.

  2. Set up Amazon EventBridge to capture these scaling events. You can create rules that match on the 'AlreadyAtMaxCapacity' status and trigger notifications or custom actions.

  3. For easier monitoring across your 100+ clusters, you could create a centralized logging solution. Use AWS Lambda functions triggered by EventBridge to collect and aggregate scaling activity data from all your clusters into a central location, such as an Amazon CloudWatch Log Group or an Amazon S3 bucket.

  4. Create CloudWatch alarms based on the aggregated data to alert you when 'AlreadyAtMaxCapacity' events occur frequently, indicating that you may need to adjust your maximum capacity settings.

Regarding graphing the number of active tasks in your clusters on a CloudWatch dashboard:

  1. Enable Container Insights for your ECS clusters if you haven't already. This will provide you with detailed metrics about your clusters, including the number of running tasks.

  2. Once enabled, you should be able to find a metric called 'RunningTaskCount' in the ECS/ContainerInsights namespace in CloudWatch.

  3. You can then create a CloudWatch dashboard and add graphs for the 'RunningTaskCount' metric for each of your clusters.

  4. To make it more manageable with 100+ clusters, consider using CloudWatch metric math to aggregate or compare task counts across multiple clusters in a single graph.

By implementing these monitoring strategies, you'll have better visibility into your cluster scaling activities and resource utilization, allowing you to optimize your min and max capacity settings more effectively across your large number of clusters.
Sources
Scaling activities for Application Auto Scaling - Application Auto Scaling
How to monitor high resource usage in Amazon EKS tasks and services | AWS re:Post

answered 2 years ago

  • RunningTaskCount is not available without enabling the very expensive Container Insights !!?!?!?

    this doesn't answer to main question: how to track AlreadyAtMaxCapacity

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.