CloudWatch and procstat - unclear documentation

0

Hi,

It was announced in January 2019 that you can use the procstat plugin with CloudWatch Agent to monitor individual processes. Unfortunately the documentation isn't very clear whether this plugin is included with the CloudWatch Agent or its a separate installation? If its the latter can anyone provide information to support installing it with CloudWatch?

Thanks,
JC

References below:

https://aws.amazon.com/about-aws/whats-new/2019/01/amazon-cloudwatch-agent-adds-support-for-procstat-plugin-and-multiple-configuration-files/

https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-procstat-process-metrics.html#CloudWatch-Agent-procstat-configuration

JC2019
asked 5 years ago1582 views
2 Answers
0
Accepted Answer

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
  1. 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}

answered 5 years ago
0

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

JC2019
answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions