I have an Ubuntu EC2 instance. I manually created the following basic CloudWatch Agent config file in:
/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json
{
"metrics": {
"metrics_collected": {
"collectd": {},
"mem": {
"measurement": [
"used_percent",
"total"
]
},
"disk": {
"measurement": [
"used_percent",
"total"
]
}
}
}
}
I'm trying to start the CloudWatch Agent using the command below.
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a start
Then I check the status using the command below to confirm that it's running.
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a status
But I get the output below that shows the Agent as being in a stopped status.
{
"status": "stopped",
"starttime": "",
"version": "1.223987.0"
}
I checked the log file below.
/var/log/amazon/amazon-cloudwatch-agent
It contains:
2019/07/23 06:51:04 I! I! Detected the instance is EC2
2019/07/23 06:51:04 Reading json config file path: /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json ...
Valid Json input schema.
I! Detecting runasuser...
No csm configuration found.
No log configuration found.
No structuredlog configuration found.
Configuration validation first phase succeeded
2019/07/23 06:51:04 I! Config has been translated into TOML /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.toml
2019/07/23 06:51:04 Reading json config file path: /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json ...
2019/07/23 06:51:04 I! Detected runAsUser: root
What do I need to do get the CloudWatch Agent running?
For CentOS
yum update && yum install epel-release && yum install collectd
For Ubuntu
sudo apt-get update && sudo apt-get install collectd
The above solution didn't work for me:
yum update && yum install epel-release && yum install collectd
However, I used the following command and the epel
and collectd
were installed without a problem:
EPEL:
sudo amazon-linux-extras install epel -y
Collected:
sudo amazon-linux-extras install collectd -y
My Linux Distribution: Amazon Linux 2( Elastic Beanstalk 64bit Amazon Linux 2 running Tomcat 8.5 Corretto 8)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With