Created
February 6, 2020 10:27
-
-
Save shabin-slr/0ac265705b0983a508a6b8dff56abf37 to your computer and use it in GitHub Desktop.
CloudWatch Agent Installation and config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download RPM from S3 | |
wget https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm | |
# Install package | |
sudo rpm -U ./amazon-cloudwatch-agent.rpm | |
# Launch Wizard to generate configuration file | |
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard | |
# Edit config | |
sudo vim /opt/aws/amazon-cloudwatch-agent/bin/config.json | |
# Start agent | |
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 | |
# Sample config file | |
{ | |
"agent": { | |
"metrics_collection_interval": 30, | |
"run_as_user": "ec2-user" | |
}, | |
"metrics": { | |
"append_dimensions": { | |
"AutoScalingGroupName": "${aws:AutoScalingGroupName}", | |
"ImageId": "${aws:ImageId}", | |
"InstanceId": "${aws:InstanceId}", | |
"InstanceType": "${aws:InstanceType}" | |
}, | |
"metrics_collected": { | |
"disk": { | |
"measurement": [ | |
"used_percent" | |
], | |
"metrics_collection_interval": 30, | |
"resources": [ | |
"*" | |
] | |
}, | |
"mem": { | |
"measurement": [ | |
"mem_used_percent" | |
], | |
"metrics_collection_interval": 30 | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment