Skip to content

Instantly share code, notes, and snippets.

@jamesonjlee
Last active January 11, 2020 22:53
Show Gist options
  • Save jamesonjlee/374c8de8223e72f90c39 to your computer and use it in GitHub Desktop.
Save jamesonjlee/374c8de8223e72f90c39 to your computer and use it in GitHub Desktop.
running AWS Cloudwatch Monitor tool on CentOS6.5
yum install -y perl-CPAN
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")'
# 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
# you should be using IAM Role (need cloudwatch PUT and maybe list?)
./mon-put-instance-data.pl --disk-path=/ --disk-space-util --mem-util
# now make root(?) run it all the time
crontab -e
# */2 * * * * ~/aws-scripts-mon/mon-put-instance-data.pl --mem-util --disk-space-util --disk-path=/ --from-cron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment