Skip to content

Instantly share code, notes, and snippets.

@tovbinm
Created December 6, 2012 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tovbinm/4220948 to your computer and use it in GitHub Desktop.
Save tovbinm/4220948 to your computer and use it in GitHub Desktop.
Setup Amazon CloudWatch for Debian
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