Custom Metric in Amazon CloudWatch

By | May 16, 2014

Amazon CloudWatch is an Amazon Web Service (AWS) utility tool, which allows monitoring of various components like EC2 instance, Elastic load balancer and EBS volumes. One can also monitor CPU utilization, disk read byte, disk writes byte, networking in and networking out for EC2 instance with its support.

Amazon CloudWatch provides custom metrics to avoid various problems. With the help of Amazon CloudWatch, one can simply define the custom metric based on one’s individual need or requirements. And one can also update it at regular intervals.

This can be simply demonstrated by using an example of a free memory. The main objective in this instance is to define a custom metric for a free memory and constant input the data to the metric using the machine which needs to be monitored.

  • INSTALL – install/setup the AWS cloud-watch Command line from http://aws.amazon.com/developertools/2534
  • Setup the API as you would for any AWS Command line tool
  • Export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/jre/
  • Export AWS_CLOUDWATCH_HOME=/opt/cloudwatch/ or the location where you have unzipped the utility
  • Export PATH=$AWS_CLOUDWATCH_HOME/bin:$PATH;
  • To define a new metric eg. Free Memory,

ubuntu@domU-12-41-32-0B-01-A7:~$ mon-put-data -m “FreeMemory” –namespace metaoption –dimensions “instance=i-f23233,servertype=MongoDB” –value 100 -u Bytes

The command will create a free memory in the next 20 minutes, with the customized namespace and dimensions, set as per your needs. For the instance, we have to choose a dummy value and the unit we choose is bytes.

For more information please go through the link:

http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/index.html?CLIReference.html

Once it is created, we need to continuously update the data to the metrics that contain information about the current memory status of the system and can be used as the data source.

Deleting Custom Metrics:

A cloud metric will be automatically deleted once it remains unused for 2 weeks.

Pricing: $ 0.50 per metric per month

Leave a Reply

Your email address will not be published. Required fields are marked *