Forked from yuta-imai/UserData script for setup CloudWatch
Last active
February 2, 2022 12:06
-
-
Save martinzuern/02174b5dd69fa75d4b246d046f75b1fd to your computer and use it in GitHub Desktop.
With this user data script, you can set up cron job to put some custom metrics for CloudWatch at instance initiation.
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
#!/bin/sh | |
yum install -y perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https perl-Digest-SHA unzip | |
cd /home/ec2-user | |
curl http://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.1.zip -O | |
unzip CloudWatchMonitoringScripts-1.2.1.zip | |
rm -rf CloudWatchMonitoringScripts-1.2.1.zip | |
chown ec2-user:ec2-user aws-scripts-mon | |
echo "* * * * * ec2-user /home/ec2-user/aws-scripts-mon/mon-put-instance-data.pl --mem-util --swap-util --aggregated --auto-scaling --from-cron" >> /var/spool/cron/ec2-user | |
echo "0 * * * * ec2-user /home/ec2-user/aws-scripts-mon/mon-put-instance-data.pl --disk-space-used --disk-space-avail --disk-space-util --disk-path=/ --aggregated --auto-scaling --from-cron" >> /var/spool/cron/ec2-user |
Este es Excelente, Gracias!
Thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mhtngo unzip is installed in line 2 (it’s the very last package)