Monday, 24 July 2017

Creating an AWS cloudwatch alarm


Amazon provides the Cloudwatch monitoring service to monitor AWS resources in our cloud infrastrucutre.
We can collect/track/report default metrics available with cloudwatch and we can also use custom metrics, collect and monitor logs.
Cloudwatch allows us to set alarms on billing and AWS resources such as EC2, RDS, EBS etc. In addition to alarming capability cloudwatch allows us to collect resource usage information over a period of time so that we can derive a usage trend and base future resource consumption decisions based on this trend.

In this article I'll describe how we can set up a cloudwatch alarm (using the cloudwatch dashboard and directly from an EC2 instance).

To view the cloudwatch dashboard click on cloudwatch from the management tools section of the AWS services dashboard.

From here click on alarms. The below screen will be displayed.




Click on Create Alarm.

This brings up the metric selection section.


A metric is a charactoristic of an AWS service that we'd like cloudwatch to measure and report on.

In this article I'll be configuring an alarm for an EC2 instance so I clicked on 'Across All Instances" from the EC2 Metrics section.


This will show the available metrics for the selected category. Let's select CPU utilization and then click next.

Now we'll be creating our alarm definition.


Here we define our alarm threshold and the action to be taken when this threshold is breached.

I've defined an alarm to be triggered whenever CPU utilization is greater than or euqal to 10% for one consecutive period of 5 minutes. I've directed the action to trigger an email to an email id mentioned in the email list box. The notification handling is being done by SNS. The 'Send notifcation to' section is the topic, the 'email list' is the subscriber and the cloudwatch alarm is the producer here.

Once the reqiered information has been entered click on create alarm.



This message tells us that the email address we've mentioned in the email list section while creating the alarm has received an email from AWS and must respond to it in order to get subscribed to the topic and being receiving alert emails.

I received the below email from AWS.


I need to click on confirm subscription to confirm that I wish to receive alerts from this topic.


In the meantime if we go to our Alarm section in our AWS dashboard we will observe that our alarm has been set and current state is insufficent data.


This is because the alarm has been recently set up and cloudwatch is gathering data. This should subside after a while.

In a similar fashion I created an alarm for a specific AWS instance from the instance management dashboard as shown below.


This is showing in alarm state becuase  the threshold of 10% I had defined in the alarm has been breached. Furthermore I received an emil from cloudwatch as well alerting me of the CPU utilization breach on the instance.
Here is a screenshot of the email.


1 comment:

  1. Thanks for providing your information for more updates contact with AWS Online Course Bangalore

    ReplyDelete

Using capture groups in grep in Linux

Introduction Let me start by saying that this article isn't about capture groups in grep per se. What we are going to do here with gr...