AWS Classroom Series – 24/Jun/2021

Monitoring custom metrics using cloud watch

  • In this series, lets see how to use cloud watch agent to monitor custom metrics
  • Downloading and installing the cloud watch agent Refer Here
  • Installing on Amazon linux2
 wget https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
 sudo rpm -ivh amazon-cloudwatch-agent.rpm
  • Install the collectd if you want to collect custom metrics (Collect application and system performance metrics on a periodic basis)
sudo amazon-linux-extras install collectd
  • Creating an IAM role used by CloudWatch agent

    • Navigate to IAM Console and create an IAM Role
  • Attach this IAM role to the ec2 instance

  • Run the cloud watch agent on the ec2 instance

sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
  • Once the wizard creation is completed it will create a configuration file @/opt/aws/amazon-cloudwatch-agent/bin/config.json
  • To validate and start the cloud watch agent
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json -s
  • To verify if the cloudwatch agent is running
ps aux | grep -i amazon-cloudwatch-agent
  • Now navigate to the cloud watch and check metrics

CloudWatch Events

  • AWS Cloud watch events are similar to alarms but instead of configuring alarms or thresholds, they match event patterns.
  • The event patterns can be related to
    • EC2 state change
    • S3 File upload
    • RDS instance State change

  • Exercise
    • Create an Event to notify when ec2 instance state is changed for all the ec2 instances.
    • Shutdown the ec2 instance and verify the email.

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%