Skip to content

Instantly share code, notes, and snippets.

@jarrodmedrano
Created February 16, 2023 20:14
Show Gist options
  • Save jarrodmedrano/db16735f4b32b8d73419ad838ba40f69 to your computer and use it in GitHub Desktop.
Save jarrodmedrano/db16735f4b32b8d73419ad838ba40f69 to your computer and use it in GitHub Desktop.
installing cloudwatch agent
wget https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
sudo rpm -U ./amazon-cloudwatch-agent.rpm
# IAM ROLE
EC2 Role
EC2
CloudWatchAgentServerPolicy
And AmazonSSMFullAccess
CloudWatchRole
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
# Accept all defaults, until default metrics .. pick advanced.
# then when asking for log files to monitor
# 1 /VAR/LOG/SECURE
/var/log/secure
/var/log/secure
(Accept default instance ID)
# 2 /var/log/httpd/access_log
/var/log/httpd/access_log
/var/log/httpd/access_log
(Accept default instance ID)
# 3 /var/log/httpd/error_log
/var/log/httpd/error_log
/var/log/httpd/error_log
(Accept default instance ID)
# Config will be stored in /opt/aws/amazon-cloudwatch-agent/bin/config.json and stored in SSM
# Bug Fix
sudo mkdir -p /usr/share/collectd/
sudo touch /usr/share/collectd/types.db
# Load Config and start agent
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c ssm:AmazonCloudWatch-linux -s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment