1

我有以下 Auto Scaling 策略,它应该在 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 脚本。

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 预留图

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

4

1 回答 1

1

我想我发现了这个问题。它位于 CloudFormation 模板中。当使用命名空间作为 AWS/ECS 以下是有效维度时,

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

因此,警报无效并被卡在 INSUFFICIENT_DATA 中,我在阅读本文后才意识到,

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

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

于 2018-09-11T01:38:02.990 回答