如果邮件发送到SQS
,我试图触发警报。但是,我看到CloudWatch
指标表明有消息但没有触发警报。
警报当前也处于INSUFFICIENT_DATA
状态。为了进行测试,我正在通过boto3
客户端发送消息。
下面是我的SQS
和CloudWatch
警报的CloudFormation模板
QueueMessageAlarm:
Type: AWS::CloudWatch::Alarm
Condition: AlarmsEnabled
Properties:
AlarmDescription: "Alarm if queue message is greater than 0"
AlarmActions:
- !Ref SampleNotificationTopic
Namespace: "AWS/SQS"
MetricName: "NumberOfMessagesReceived"
Statistic: "Sum"
Period: "900"
EvaluationPeriods: "1"
Threshold: "0"
ComparisonOperator: "GreaterThanThreshold"
Dimensions:
- Name: "QueueName"
- Value:
Fn::GetAtt:
- "KinesisStreamFileQueue"
- "QueueName"
KinesisStreamFileQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: "StreamQueue"
答案 0 :(得分:0)
使用ApproximateNumberOfMessagesVisible指标而不是任何“已接收”指标。
使用“已接收”度量标准的缺点是,除非您不断接收消息,否则您很可能会陷入INSUFFICIENT_DATA
中,从而导致警报问题。
答案 1 :(得分:0)
我通过更改警报资源的➜ ~ curl -I https://ddl.oxidepolska.pl/1544820059040-lootconfig.zip
HTTP/2 200
server: nginx
date: Fri, 14 Dec 2018 21:54:56 GMT
content-type: application/zip
content-length: 7138
last-modified: Fri, 14 Dec 2018 20:40:59 GMT
etag: "5c14155b-1be2"
accept-ranges: bytes
Dimensions
来解决问题。该资源需要引用队列的properties
,并且先前已经获取了队列的arn
url