- Newest
- Most votes
- Most comments
Hi JC,
I have verified that the procstat plugin is installed by default within the CloudWatch Agent. To verify, I followed these steps on Amazon Linux 2 in us-east-1.
1. SSH'd to my EC2 instance
2. wget https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
3. sudo rpm -U amazon-cloudwatch-agent.rpm
- modified the /opt/aws/amazon-cloudwatch-agent/bin/config.json to include the following:
{
"metrics": {
"metrics_collected": {
"procstat": [
{
"pid_file": "/var/run/sshd.pid",
"measurement": [
"cpu_usage",
"memory_rss"
]
},
{
"pid_file": "/var/run/syslogd.pid",
"measurement": [
"read_bytes",
"read_count",
"write_bytes"
],
"metrics_collection_interval": 60
}
]
}
}
}
Then I attached a Role to the EC2 instance that had the following two AWS managed policies:
CloudWatchAgentServerPolicy
AmazonSSMManagedInstanceCore
The Role also had the following Trust Relationship Policy Document:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
I then went back to the SSH session and typed:
cd /opt/aws/amazon-cloudwatch-agent/bin
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json -s
If there are any problems, you can debug by running:
tail -f /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log
In your CloudWatch Metrics, You will find a CWAgent with metrics for rsyslogd and sshd.
Hope this helps (and hopefully, I captured all of the commands above)
-randy
{code}
Hi Randy,
Thanks for confirming it is included with the CloudWatch Agent, I've also managed to get it up and running using your example commands.
Many thanks,
JC
Relevant content
- asked 6 days ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 20 days ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 months ago