弹性伸缩 - 无法横向扩展 CPU 预留指标



我有以下自动扩展策略,当 CPU 预留超过 75% 时,该策略应添加实例。我没有看到此设置触发的任何警报

Policy type:
Simple scaling
Execute policy when:
ECS-CPUHighAlarm
breaches the alarm threshold: CPUReservation > 75 for 5 consecutive periods 
of 60 seconds for the metric dimensions AutoScalingGroupName = ECS-
ECSAutoScalingGroup
Take the action:
Add 1 instances And then wait: 600 seconds before allowing another scaling 
activity

下面是CloudFormation Script。

CPUHighAlarm:
Type: 'AWS::CloudWatch::Alarm'
Properties:
EvaluationPeriods: 5
Statistic: Average
Threshold: 75
AlarmDescription: 'Alarm if CPU reservation is high.'
Period: 60
AlarmActions:
- !Ref 'CPUScalingUpPolicy'
Namespace: 'AWS/ECS'
Dimensions:
- Name: AutoScalingGroupName
Value: !Ref 'ECSAutoScalingGroup'
ComparisonOperator: GreaterThanThreshold
MetricName: CPUReservation

但根据我在下面给出的图表中观察到的情况,它并没有发生。 CPU 预留图表

关于我缺少配置的任何想法?

我想我发现了这个问题。它在云形成模板中。当将命名空间用作 AWS/ECS 时,以下是有效的维度,

Dimensions:
- Name: ClusterName
Value: !Ref 'ECSClusterName'

因此,警报无效并且被卡为INSUFFICIENT_DATA这是我后来在阅读本文后才意识到的,

https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ecs-metricscollected.html

我运行了测试,警报被触发并自动缩放。

最新更新