简体   繁体   中英

AWS CloudWatch alarm for SQS Number of Messages Visible

I am trying to capture the event of a new message in my FIFO queue (as I want to avoid , infinite polling of Queue) .

For this purpose I am evaluating the CloudWatch alarm option with metrics ApproximateNumberOfMessagesVisible .

Following is my Alarm description-

Threshold : The condition in which the alarm will go to the ALARM state.ApproximateNumberOfMessagesVisible >= 0 for 1 minute

Actions :The actions that will occur when the alarm changes state. In ALARM:
Send message to topic "topic_for_events_generated_bycloudwatch" (xyz@xyz) Send message to topic "topic_for_events_generated_bycloudwatch"

Period :The granularity of the datapoints for the monitored metric.1 minute

Following are my queries -

  1. Assuming there are more than 0 messages in the given Q - will this alarm raised only once when the condition met or every minute ?
  2. During quick test I saw Alarm keeping moving between INSUFFICIENT and ALARM state in random other without any configuration changes, what could be rational ?

Screenshot of ApproximateNumberOfMessagesVisible metric graph Screenshot of the log activity

Thanks in advance.

Regards, Rohan K

Cloudwatch will alarm once the threshold is breached for state transition.

From the Docs

Alarms invoke actions for sustained state changes only. CloudWatch alarms do not invoke actions simply because they are in a particular state, the state must have changed and been maintained for a specified number of periods.

But

After an alarm invokes an action due to a change in state, its subsequent behavior depends on the type of action that you have associated with the alarm. For Amazon EC2 and Auto Scaling actions, the alarm continues to invoke the action for every period that the alarm remains in the new state. For Amazon SNS notifications, no additional actions are invoked.

An Example:

In the following figure, the alarm threshold is set to 3 units and the alarm is evaluated over 3 periods. That is, the alarm goes to ALARM state if the oldest of the 3 periods being evaluated is breaching, and the 2 subsequent periods are either breaching or missing. In the figure, this happens with the third through fifth time periods, and the alarm's state is set to ALARM. At period six, the value dips below the threshold, and the state reverts to OK. Later, during the ninth time period, the threshold is breached again, but for only one period. Consequently, the alarm state remains OK.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM