-
-
Save jamesbjackson/9faa240abe5599b19801 to your computer and use it in GitHub Desktop.
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
wget -O /opt/cw.zip http://ec2-downloads.s3.amazonaws.com/cloudwatch-samples/CloudWatchMonitoringScripts-v1.1.0.zip | |
unzip /opt/cw.zip -d /opt/ | |
rm -f /opt/cw.zip | |
yum install -y openssl openssl-devel perl-ExtUtils-MakeMaker | |
curl -L http://cpanmin.us | perl - --self-upgrade | |
cpanm Digest::SHA Bundle::LWP5_837 LWP LWP::Protocol::https | |
IAM_ROLE=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/` | |
DISK_PARAM=`mount |grep -E '[s|xv]d|mapper' | awk '{print "--disk-path="$3}' | tr '\n' ' '` | |
crontab -l 2>&1 |egrep -v 'no crontab|mon-put-instance-data' >/opt/aws-scripts-mon/cloudwatchcron | |
echo "*/5 * * * * /opt/aws-scripts-mon/mon-put-instance-data.pl --auto-scaling --mem-util --disk-space-util $DISK_PARAM --swap-util --from-cron --aws-iam-role=$IAM_ROLE" >> /opt/aws-scripts-mon/cloudwatchcron | |
crontab /opt/aws-scripts-mon/cloudwatchcron |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment