Created
December 6, 2012 00:49
-
-
Save tovbinm/4220948 to your computer and use it in GitHub Desktop.
Setup Amazon CloudWatch for Debian
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
1. Install all the required libraries: | |
sudo apt-get update && sudo apt-get -y install \ | |
unzip \ | |
perl \ | |
wget \ | |
curl \ | |
make \ | |
ncftp \ | |
liburi-perl \ | |
libcrypt-ssleay-perl \ | |
libxml-libxml-perl \ | |
libwww-perl \ | |
libyaml-perl | |
sudo cpan -i CPAN LWP::UserAgent | |
3. Get CloudWatch monitoring scripts: | |
sudo -i | |
mkdir -p /opt/aws-scripts-mon; cd /opt/aws-scripts-mon | |
wget http://ec2-downloads.s3.amazonaws.com/cloudwatch-samples/CloudWatchMonitoringScripts.zip | |
unzip CloudWatchMonitoringScripts.zip && rm CloudWatchMonitoringScripts.zip | |
4. Set your credentials: | |
echo -e "AWSAccessKeyId=<aws_key>\nAWSSecretKey=<aws_secret>" > /opt/aws-scripts-mon/awscreds.conf | |
5. Test it: | |
/opt/aws-scripts-mon/mon-get-instance-stats.pl --recent-hours=12 | |
6. Add a crontab job to report memory and disk usage: | |
crontab -e | |
*/5 * * * * /opt/aws-scripts-mon/mon-put-instance-data.pl --mem-util --disk-space-util --disk-path=/ --disk-path=/mnt --from-cron | |
7. More info: | |
How to use scripts - http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/mon-scripts-perl.html | |
IAM Permissions - http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/UsingIAM.html | |
http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/CHAP_UsingCloudWatch.html | |
https://forums.aws.amazon.com/message.jspa?messageID=276248 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment