Skip to content

Instantly share code, notes, and snippets.

@zetxek
Forked from jamesonjlee/run.sh
Last active January 19, 2017 16:50
Show Gist options
  • Save zetxek/c970f41b92fd95ccc11265d2e6c00ae1 to your computer and use it in GitHub Desktop.
Save zetxek/c970f41b92fd95ccc11265d2e6c00ae1 to your computer and use it in GitHub Desktop.
running AWS Cloudwatch Monitor tool on CentOS6.5 without having EC2 roles in place
yum install -y perl-CPAN nano wget zip unzip perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https gcc gcc-c++ make openssl-devel
export PERL_MM_USE_DEFAULT=1
# setup default config
perl -MCPAN -e shell # make sure to exit
# need to wait here
perl -MCPAN -e 'CPAN::Shell->rematein("notest", "install", "Bundle::CPAN")'
perl -MCPAN -e 'CPAN::Shell->rematein("notest", "install", "CPAN")'
perl -MCPAN -e 'CPAN::Shell->rematein("notest", "install", "Bundle::LWP")'
perl -MCPAN -e 'CPAN::Shell->rematein("notest", "install", "LWP")'
perl -MCPAN -e 'CPAN::Shell->rematein("notest", "install", "LWP::Protocol::https")'
perl -MCPAN -e 'CPAN::Shell->rematein("notest", "install", "Crypt::SSLeay")'
perl -MCPAN -e 'CPAN::Shell->rematein("notest", "install", "Switch")'
perl -MCPAN -e 'install LWP::Protocol::https'
perl -MCPAN -e 'install Bundle::CPAN'
perl -MCPAN -e 'install Bundle::LWP5_837'
cpan -i Compress::Raw::Zlib
# now get the cloudwatch scripts
wget http://ec2-downloads.s3.amazonaws.com/cloudwatch-samples/CloudWatchMonitoringScripts-v1.1.0.zip
unzip CloudWatchMonitoringScripts-v1.1.0.zip
cd aws-scripts-mon
cp awscreds.template awscreds.conf
vi awscreds.conf
# now make it run all the time
crontab -e
# */5 * * * * /root/aws-scripts-mon/mon-put-instance-data.pl --mem-util --disk-space-util --disk-path=/ --disk-path=/export/ --mem-used --mem-avail --swap-util --swap-used --disk-space-used --disk-space-avail --aws-credential-file=/root/aws-scripts-mon/awscreds.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment