cloudwatch-agent

  • You can create a custom metrics for Memory usages using cutom metrices
  • After you are connected to the instance, type below command: (install some perl dependencies)
  • sudo yum install perl-Switch perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https -y

Download custom monitoring script provided by AWS

To keep the Metrics onto cloudwatch

  • ./mon-put-instance-data.pl --mem-util --mem-util --mem-used-incl-cache-buff --mem-used --mem-avail
  • Now go to EC2 console and click on monitoring tab on buttom, click on view-CLoudWatch metrices.
  • Note the right instance id. Click on Linux System under custom namespaces and click on InstanceId.
  • You can now select the metric Name and see the results in line or percentage.

Automating the metrices

  • We don't want to put the metrices every time manually. The whole point of metrices is to monitor our instances without having to go into them.
  • Let's schedulte the monitoring in 1 minute for our lab. You may want to do it in 5 mins or so.
  • you may now use -- crontab -e and schedute */1 * * * * * /home/ec2-user/awscripts-mon/mon-put-instance-data.pl --mem-util --mem-util --mem-used-incl-cache-buff --mem-used --mem-avail and save it.
  • crontab -l to see if it is set up correctly
  • You may go to graphed metrics on aws console change the period to 1 minutes to see more detailed metrics.

The alternate way of setting up the metrics without roles and permissions is to provide the access key and secret access key to the awscreds.template.