A metric alarm watches a single CloudWatch metric or the result of a math expression based on CloudWatch metrics. The alarm performs one or more actions based on the value of the metric or expression relative to a threshold over a number of time periods. The action can be an Amazon EC2 action, an Amazon EC2 Auto Scaling action, or a notification sent to an Amazon SNS topic.
ClusterNamedimension and select one of the CPU Utilization metrics. If you see
pod_cpu_utilization, select that which will show your screen similar to the one below
Select metricwhich will take you to the screen as the one below
Enter the threshold value (for example, 50 which means 50% CPU utlization because this metric is a percent type) that you want the metric data to be monitored. Notice that
Static option is selected by default, which means we will be setting a static value as the threshold to be monitored.
Additional configuration where you can indicate how many occurences of the breach qualifies for the alarm to be triggered. Set the values to 2 out of 5, which will make the alarm get triggered if there has been 2 breaches in 5 evaluation periods. Notice the message at the top of the graph describing the setting as
This alarm will trigger when the blue line goes above the red line for 2 datapoints within 25 minutes.
Configure actions screen, you can set what action you want to take when the alarm changes to different states such as
The available options for actions include, - Send a notification to an SNS topic - Take an Auto scaling action - EC2 action if the metric is from an EC2 instance
Create a new topic to create a new SNS topic to send the notification to and provide your email address.
Create topicto create the SNS topic
Next, give the alarm a name and click
Nextagain to review the configuration
Createto create the alarm
Once you have created the alarm, you will notice that the alarm is now in
Insufficient data state which indicates that there is not enough data to validate the alarm. Waiting for 5 minutes will change the alarm state to
OK in green.
Click on the alarm to see the alarm details as shown below. Notice the alarm state now changed to ‘OK’ after evaluation was complete.