Skip to content

Instantly share code, notes, and snippets.

@shokoe
Last active February 5, 2017 14:21
Show Gist options
  • Save shokoe/1400c529937e8b571ed61fd86954e7e5 to your computer and use it in GitHub Desktop.
Save shokoe/1400c529937e8b571ed61fd86954e7e5 to your computer and use it in GitHub Desktop.
Cron script for report all possible metrics to CloudWatch using 'Amazon CloudWatch Monitoring Scripts for Linux' from https://aws.amazon.com/code/8720044071969977 (requires the load patch).
#!/bin/bash
# crontab line:
# * * * * * <PATH_TO>/aws-scripts-mon-cron.sh
/opt/aws-scripts-mon/mon-put-instance-data-patch-load.pl --aws-access-key-id='AKIAxxxxxxxxxxxxxxxx' --aws-secret-key='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--mem-util --mem-used --mem-avail --swap-util --swap-used \
$(df -h -x "tmpfs" -x "devtmpfs" | sed 1d | awk '{print $6}' | sort -u | while read i; do echo -n " --disk-path=$i"; done) \
--disk-space-util --disk-space-used --disk-space-avail \
--load-1 --load-5 --load-15 \
--from-cron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment