我尝试创建一个 AWS 警报来监视 SQS。如果队列在 2 分钟内有超过 1 条消息,我想创建一个警报来触发策略。我使用此命令来创建警报:
aws cloudwatch put-metric-alarm --alarm-name alarmName --metric-name ApproximateNumberOfMessagesVisible --namespace "AWS/SQS" --statistic Average --period 60 --evaluation-periods 2 --threshold 1 --comparison-operator GreaterThanOrEqualToThreshold --dimensions "Name=QueueName,Value=QueueName" "Name=AutoScalingGroupName,Value=asg-name" --alarm-actions "<arn:batch-upscale-policy>" --actions-enable
我可以在 AWS 控制台中看到警报,但它停留在 INSUFFICIENT_DATA
状态。我该如何修复它?
这里我要监听其他AWS帐户中的队列。这可能吗?!
最佳答案
如果您还没有正在运行的进程轮询队列,那么您所看到的情况是正常的。您必须运行一些至少会定期轮询队列的程序,然后数据不足的情况应该会自行清除。如果队列在大约 6 小时内没有生产者或消费者,SQS 不会向 cloudwatch 发送任何内容。
The metrics you configure with CloudWatch for your Amazon SQS queues are automatically collected and pushed to CloudWatch every five minutes. These metrics are gathered on all queues that meet the CloudWatch guidelines for being active. A queue is considered active by CloudWatch for up to six hours from the last activity (i.e., any API call) on the queue.
关于amazon-web-services - AWS 警报在创建时卡在 INSUFFICIENT_DATA 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19761995/