Monitoring Applications: Custom CloudWatch Metrics Using AWS Systems Manager

By default monitoring, we will get only metrics Like CPUUtilization, StatusCheckFailed_System, and StatusCheckFailed_Instance, etc.

If we want to monitor Custom metrics (Memused, Logical disk usage, Autoscaling metrics, etc.), we must install and configure the SSM agent to send data to AWS CloudWatch.

Find below the steps to download, install and configure SSM agents to send custom metrics to AWS Cloudwatch.

Log in to your instance by using Remote Desktop.

Download the latest version of SSM Agent to your instance. You have two options for downloading:

1. PowerShell:

Run the following PowerShell command. This command lets you download SSM Agent without adjusting Internet Explorer (IE) Enhanced Security settings.

Running powershell command

Invoke-WebRequest https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/windows_amd64/AmazonSSMAgentSetup.exe -OutFile $env:USERPROFILE\\Desktop\\SSMAgent_latest.exe

Download the latest version of SSM Agent to your instance by using the following link. If you want, update this URL with a region-specific URL.

https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/windows_amd64/AmazonSSMAgentSetup.exe

Run the downloaded AmazonSSMAgentSetup.exe file to install SSM Agent.

Start or restart SSM Agent by sending the following command in PowerShell:

Restart-Service AmazonSSMAgent

Update SSM agent on instance.

Go to Systems Manager:

In Run a Command selects AWS-UpdateSSMAgent.

Selecting AWS-UpdateSSMAgent in Run command

In the Targets section, We can select how many servers we want.

Selecting servers in targets section

Check platform within AWS Command Line Interface command tab

AWS Command Line Interface command tab

Click on Run Command.

In the Command document list, choose AWS-ConfigureAWSPackage.

Choosing AWS-ConfigureAWSPackage in command document list

In the Action list, choose Install.

In the Name field, type AmazonCloudWatchAgent.

Type AmazonCloudWatchAgent in the name field

In the Targets area, choose the instance on which to install the CloudWatch agent.

choose the instance on which to install the CloudWatch agent

Check platform within the AWS Command Line Interface command tab and Choose Run at last.

AWS Command Line Interface command tab

Go to AWS Systems Manager => Parameter Store

Create a Parameter name like this for Windows (AmazonCloudWatch-Windows).

Click on Create parameter,

Name field enters AmazonCloudWatch-Windows.

Parameter details

Select Tier Standard

Selecting tier standard

Select Type String.

Select type string

In Value Box we need to paste the code for our requirements.

Pasting code in value box

For Windows:

{

“metrics”: {

“append_dimensions”: {

“AutoScalingGroupName”: “${aws:AutoScalingGroupName}”,

“ImageId”: “${aws:ImageId}”,

“InstanceId”: “${aws:InstanceId}”

},

“metrics_collected”: {

“LogicalDisk”: {

“measurement”: [

“% Free Space”

],

“metrics_collection_interval”: 300,

“resources”: [

“*”

]

},

“Memory”: {

“measurement”: [

“% Committed Bytes In Use”

],

“metrics_collection_interval”: 300

},

“statsd\”: {

“metrics_aggregation_interval”: 300,

“metrics_collection_interval”: 300,

“service_address”: “:8125”

}

}

}

}

The above code is used to get Auto scaling metrics, Logical disk usage, and Memory usage.

In the Command document list, choose AmazonCloudWatch-ManageAgent.

choosing AmazonCloudWatch-ManageAgent in command document list

In Command parameters

In the Action list, choose to configure.

In the Optional Configuration Source list, choose ssm.

In the Optional Configuration Location box, type the name of the agent configuration file you created and saved to Systems Manager Parameter Store, for example- Optional Configuration Location: AmazonCloudWatch-Windows.

Command parameters

In the Targets section, please select how many instances we want.

Selecting instances in targets

Check the platform within the AWS Command Line Interface command tab and Choose Run.

AWS command line interface command

This will start sending Cloudwatch metrics such as Memory utilization, Disk usage, and autoscaling group metrics, and you can see them in Cloudwatch metrics.

Share

Search Post

Recent Posts

An Overview of Top 5 AWS AI/ML Services You Should Know in 2024
November 15, 2024
Backup as a Service – Explained!
November 8, 2024
Harnessing Generative AI for Effective Voice Search Optimization: The Comprehensive Guide
November 4, 2024

Categories

Tags

Subscribe to the
latest insights

Subscribe to the latest insights

Related Posts

An Overview of Top 5 AWS AI/ML Services You Should Know in 2024

Backup as a Service – Explained!

Harnessing Generative AI for Effective Voice Search Optimization: The Comprehensive Guide

Get in Touch!

Are you prepared to excel in the digital transformation of healthcare with Rapyder? Let’s connect and embark on this journey together.

I accept T&C and Privacy