IBM Support

Setting up CloudWatch Memory Metrics on Windows Instances on AWS

How To


Summary

Turbonomic leverages MemoryUsed reported into CloudWatch. This document covers configuring the AWS CloudWatch agent to capture Windows EC2 MemoryUsed stats in Turbonomic by leveraging AWS Systems Manager.



If you wish to perform this action manually on a Windows instance using a local configuration file (CloudWatch config file) please follow the steps outlined in this AWS article https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html#send_logs_cwl_configfile

Steps

Prerequisites

  • AWS SSM Agent Installed on EC2: Install SSM Agent
  • IAM Role with the following permissions: AmazonSSMFullAccess

      Note, the least privilege permissions needed for the IAM role are AmazonEC2RoleforSSM (custom policy to allow the action "ssm:GetParameter" to the resource "arn:aws:ssm:*:*:parameter/*", see JSON  example)

Attach IAM Role

To configure each Windows EC2 instance through System Manager you need to attach an IAM role with the above permissions to each EC2 instance. 

Select the EC2 instance and click Actions>Instance Settings>Attach/Replace IAM role. Then select the IAM role with the required permissions and click Apply (see example below).  

Now you should see the Role attached to the EC2 instance (see CloudWatch_Turbonomic in the example below).

Install the CloudWarch Agent:

  1. Open the Systems Manager console at https://console.aws.amazon.com/systems-manager/.

  2. In the navigation pane, choose Run Command.

  3. Choose Run command.

  4. In the Command document list, choose AWS-ConfigureAWSPackage.

  5. In the Targets area, choose the instance to install the CloudWatch agent on. If you don't see a specific instance, it might not be configured for Run Command. For more information, see Systems Manager Prerequisites in the AWS Systems Manager User Guide.

  6. In the Action list, choose Install

  7. In the Name field, enter: AmazonCloudWatchAgent

  8. Keep Version set to latest to install the latest version of the agent

  9. Choose Run

        Optional:  To verify a successful install select the button next to an instance name in the Targets and Outputs area, and choose View output. Systems Manager should show that the CloudWatch agent was successfully installed.

Creating Parameter Store

Now you will need to create a parameter store for the CloudWatch configuration (download it from here , also attached below) so it can be deployed across multiple EC2 Windows instances:

  1. Navigate the EC2 service under the account and region you'd like to configure  
  2. In the navigation pane, choose Parameter Store
  3. If you don't have any Parameter Store then you will see the Welcome Screen. Click Get Started Now
  4. Copy and paste the JSON configuration from he above step into the Value field (see example below)

  5. Under the Name field, you can enter any name but you must use the same name in steps below, for example, we used the name CloudWatchWindows
  6. Now click Create - you should see a message saying it has been successfully created.

Once you click Close you should the Parameter created (see example below) 

Deploying The CloudWatch Configuration File

  1. In the navigation pane, choose Run Command (or select System Manager from AWS services)
  2. Click Run Command once the page loads up 
  3. In the Command document list, choose AmazonCloudWatch-ManageAgent
  4. In the Targets area, choose the instance or multiple instances on which you want to deploy CloudWatch Configuration
  5. Under Action select configure 
  6. Under Mode leave it as ec2
  7. Change the Optional Configuration Source to ssm
  8. Under Optional Configuration Location enter the exact same name of the parameter you created in the Parameter Store (previous section). In this example, the parameter is called CloudWatchWindows
  9. Optional Restart should be set to Yes (this will restart the CloudWatch agent, not the instance)
  10. Click Run

In the end, you should see a result similar to below. 

Installation Complete!

To confirm that the instance is sending the Memory Metrics, head to the CloudWatch page, click Metrics and locate the Windows System namespace (only be created if the process worked successfully), click Windows System > InstanceId > there should be 2 Metrics per Windows instance, click 'MemeoryUsed' and confirm data is collected:

Please note it can take up to 30 minutes in some cases for Memory metric to show up in the Turbonomic user interface.

Note: This method refers to using the Run Command to enable CloudWatch metrics via the SSM agent as described herein the AWS documentation AWS Documentation

References 

DISCLAIMER: The script is provided to our customers as a courtesy. However, the script is unsupported as details of the set-up on AWS may change and the script is no longer being updated. 

Attachments:WindowsCloudWatch.json

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB45","label":"Automation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSFV9Z","label":"IBM Turbonomic Application Resource Management"},"ARM Category":[{"code":"a8m3p000000PCLHAA4","label":"Public Cloud"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Document Information

Modified date:
11 January 2023

UID

ibm16854431