In this document, we will look at how we can publish AWS used Memory stats to CloudWatch so that Turbonomic can pull the memory metrics.
AWS recently introduced a more programmatic way to add memory stats to CloudWatch through a SSM agent. This approach can be found here: Setting up CloudWatch with your Linux Instances on AWS. The approach below remains viable for the supported Linux operating systems of AWS Linux AMI, RedHat Linux, SUSE, Debian and Ubuntu.
If you are running CoreOS as the operating system for your kubernetes / OpenShift nodes, then refer to this article on how to enable the CloudWatch Monitoring Scripts via a container: Reporting to CloudWatch from CoreOS – Spencer's Blog or http://blogofit.com/monitoring_with_cloudwatch/
Latest version of the CloudWatch Monitoring Script can be found here: AWS Code
Step 1: Login to your AWS Linux instance
Step 2: Download the script from AWS Website
Step 3: Install the required prerequisites
You must run as root to be able to install these packages.
Amazon Linux AMI
- sudo yum install perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https
Red Hat Enterprise Linux
- sudo yum install perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https perl-Digest-SHA -y
- sudo yum install zip unzip
SUSE Linux Enterprise Server
- sudo zypper install perl-Switch perl-DateTime
- sudo zypper install –y "perl(LWP::Protocol::https)"
- sudo apt-get update
- sudo apt-get install unzip curl
- sudo apt-get install libwww-perl libdatetime-per
- apt-get update
- apt-get install unzip curl
- apt-get install libwww-perl libdatetime-perl liburi-perl
Step 4: Unzip the downloaded file, and then go to the extracted directory.
Step 5: Copy the awscreds.template to awscreds.conf
cp awscreds.template awscreds.conf
Step 6: vi the awscreds.conf file and add your AWS Access Key and AWS Secret Key
Step 7: Setup a Crontab so that the script runs in the background every 5 minutes.
*/5 * * * * /tmp/aws-scripts-mon/mon-put-instance-data.pl --mem-used
Now you will start seeing the used memory metrics being published to AWS CloudWatch every 5 minutes and then Turbonomic will be able to pull in the stats.