在多个SQS队列上创建CloudWatch警报 [英] Create CloudWatch alarm on multiple SQS queues

查看:103
本文介绍了在多个SQS队列上创建CloudWatch警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在自动伸缩组中有 N 个EC2实例,每个实例都在轮询 M 个SQS队列。如果可能的话,如何在所有SQS队列上的累积 roximateNumberOfMessagesVisible 上创建警报?

Suppose I have N EC2 instances in auto-scaling group, each of them is polling M SQS queues. How would I create an alarm on cumulative ApproximateNumberOfMessagesVisible across all SQS queues if possible?

推荐答案

到目前为止,没有可用的可见消息度量标准的累积计数。

There is no cumulative count of the visible messages metric available as of now.

这是解决问题的方法,

创建可以轮询队列的Lambda / cron作业,在每个队列上获取 roximateNumberOfMessages 并将总消息更新为自定义Cloudwatch指标。

Create a Lambda/ cron job that can poll the queues, get ApproximateNumberOfMessages on each queue and update the total messages to a custom Cloudwatch Metric.

QueueAttributes:

http://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_GetQueueAttributes.html

自定义Cloudwatch指标:

Custom Cloudwatch Metric:

http:// docs .aws.amazon.com / AmazonCloudWatch / latest / monitoring / publishingMetrics.html

您可以创建lambda(无服务器),也可以创建服务器基于此,您可以将总计数轮询并更新到带有CLI的自定义cloudwatch指标中,并将其更新到AWS cloudw赶上。

You can either create a lambda (serverless) or if you want to server based, you can poll and update total count into a custom cloudwatch metric with cli to AWS cloudwatch.

一旦有了cloudwatch指标,就可以基于这些数字创建警报。

Once you have have the cloudwatch metric, you can create an alarm based on those numbers.

希望它帮助。

这篇关于在多个SQS队列上创建CloudWatch警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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