每次添加消息时,AWS死信队列CloudWatch警报 [英] AWS Dead Letter Queue Cloudwatch alarm every time a message is added

查看:16
本文介绍了每次添加消息时,AWS死信队列CloudWatch警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在每次向我的DLQ添加消息时触发AWS cloudwatch警报。我正在使用云信息部署我的SQS/dlq资源,但我不知道如何配置这种类型的警报。

推荐答案

配置告警时需要使用NumberOfMessages Sent。请参阅云表单中的参考:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html这是我的解决方案。这将为每条消息发出警报,但警报状态不会清除在您的时间段内是否继续发生错误。如果警报状态没有清除,它将阻止未来的通知。所以我不会把这段时间弄得太长。

还请注意,如果您不是手动将消息添加到队列,则需要其他解决方案。

AWS Documentation 如果手动将消息发送到死信队列,则NumberOfMessagesSent度量值将捕获该消息。但是,如果由于失败的处理尝试而将消息发送到死信队列,则该度量不会捕获该消息。因此,NumberOfMessagesSent和NumberOfMessagesReceided的值可能不同。

此问题概述了一个更模糊但相似的解决方案Configure SQS Dead letter Queue to raise a cloud watch alarm on receiving a message

DLQthresholdAlarm:
 Type: AWS::CloudWatch::Alarm
    Properties:
      AlarmDescription: "Alarm dlq messages when we have 1 or more failed messages in 10 minutes"
      Namespace: "AWS/SQS"
      MetricName: "NumberOfMessagesSent"
      Dimensions:
        - Name: "QueueName"
          Value:
            Fn::GetAtt:
              - "MyDeadLetterQueue"
              - "QueueName"
      Statistic: "Sum"
      Period: 300  
      DatapointsToAlarm: 1 
      EvaluationPeriods: 2       
      Threshold: 1
      ComparisonOperator: "GreaterThanOrEqualToThreshold"
      AlarmActions:
        - !Ref MyAlarmTopic

这篇关于每次添加消息时,AWS死信队列CloudWatch警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆