ManageEngine recognized in the 2023 Gartner® Magic Quadrant™ for Application Performance Monitoring and Observability. Read the report

Configuring Cloud-Watch Agent in an EC2 instance

To collect operating system-level metrics like Memory and Disk, you must deploy the Cloud-Watch Agent inside EC2 instance. The agent will send your data to Cloud-Watch from where Applications Manager fetches and displays it in the console. Click here to know more about how you can collect metrics from amazon ec2 instances and on-premises servers with the Cloud-Watch Agent.

Prerequisites to configuring the Cloud-Watch Agent in an EC2 instance:

Supported Operating Systems:

The Cloud-Watch agent is supported on the following operating systems:
  • Amazon Linux version 2014.03.02 or later
  • Ubuntu Server version 16.04 and 14.04
  • CentOS version 7.0 and 6.5
  • Red Hat Enterprise Linux (RHEL) version 7.4, 7.0, and 6.5
  • Debian 8.0
  • 64-bit versions of Windows Server 2016, Windows Server 2012, and Windows Server 2008. 

Steps to configure the Cloud-Watch agent:

  • Create the IAM role that you need to attach to each Amazon EC2 instance that runs the CloudWatch agent. This role provides permissions for reading information from the instance and writing it to CloudWatch. Click here to know how you can create IAM roles to use with the CloudWatch Agent on Amazon EC2 Instances.
  • Attach the created IAM role to an EC2 instance. Click here to know how.
  • Install the Cloud-Watch Agent. There are two ways to install the Cloud-Watch Agent:
    • Using SYSTEMS MANAGER in ec2 console (You do not need to log in to the EC2 instance) or
    • Via direct download link. (You must log in to the EC2 instance)

Note: The metrics_collection_interval parameter indicates how often all metrics specified in this configuration file are to be collected. Make sure the value of this metric should be less than the EC2 instance polling interval. A good practice would be to set it to 5 minutes (300 seconds).

Creating a Cloud-Watch agent configuration file in the EC2 console.

  • Open the AWS EC2 console -
  • In the navigation pane, choose Parameter Store under SYSTEMS MANAGER SHARED RESOURCES
  • Click Create Parameter
    • Enter a name (Enter a name based on the OS type - ex: CwAgent Windows Config file Or CwAgent Linux Config file) and description for your parameter and choose 'Type' as 'String'
    • Copy the following configuration file content for Cloud-Watch Agent to fetch OS level metrics from EC2 instances.

Note : To modify/include/exclude the disk partitions to be monitored, see the "resources": tag in below configuration files content. Change the "resources" tag if you want to monitor different partitions other than the mentioned ones below ("resources": [ "*" ]  - means it will fetch all partitions available). Refer here for further info. Make sure the dimensions in 'append_dimensions' tag has only 'InstanceId' as mentioned below in the sample agent configuration file.

Windows OS: { "metrics": { "append_dimensions": { "InstanceId": "${aws:InstanceId}" }, "metrics_collected": { "LogicalDisk": { "measurement": [ "% Free Space", "Free Megabytes" ], "metrics_collection_interval": 300, "resources": [ "*" ] }, "Memory": { "measurement": [ "% Committed Bytes In Use", "Available MBytes", "Committed Bytes" ], "metrics_collection_interval": 300 } } } }

Linux OS: { "metrics": { "append_dimensions": { "InstanceId": "${aws:InstanceId}" }, "metrics_collected": { "mem": { "measurement": [ "mem_total", "mem_used" ], "metrics_collection_interval": 300 }, "disk": { "resources": [ "/", "/run" ], "measurement": [ "disk_total", "disk_used" ], "metrics_collection_interval": 300 }, "swap": { "measurement": [ "swap_used_percent" ], "metrics_collection_interval": 300 } } } }

Paste it in the Value* text box in the Create Parameter page and Click 'Create Parameter' to create one.

Note : Create two different configuration files. One for windows instances and another for Linux instances.