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
preguntada hace 5 años1648 visualizaciones
2 Respuestas
0
Respuesta aceptada

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}

EXPERTO
respondido hace 5 años
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
respondido hace 5 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas