Last active
August 7, 2019 03:49
-
-
Save serkanh/c75a323218cc220f8ea188066838faaa to your computer and use it in GitHub Desktop.
aws user-data script to monitor memory & volume utilization of ec2 instances
This file contains hidden or 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
#/bin/bash | |
sudo yum install unzip wget perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https perl-Digest-SHA -y | |
wget -O ~ec2-user/CloudWatchMonitoringScripts-1.2.1.zip http://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.1.zip | |
cd ~ec2-user && unzip CloudWatchMonitoringScripts-1.2.1.zip | |
chown ec2-user:ec2-user ~ec2-user/aws-scripts-mon | |
rm CloudWatchMonitoringScripts-1.2.1.zip | |
crontab -l > ~ec2-user/mycron | |
echo "*/5 * * * * ~ec2-user/aws-scripts-mon/mon-put-instance-data.pl --disk-space-util --disk-path=/ --from-cron" >> ~ec2-user/mycron | |
echo "*/5 * * * * ~ec2-user/aws-scripts-mon/mon-put-instance-data.pl --mem-used --mem-avail --swap-used" >> ~ec2-user/mycron | |
crontab ~ec2-user/mycron |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment