Skip to content

Instantly share code, notes, and snippets.

@vicly
Last active September 15, 2017 02:50
Show Gist options
  • Save vicly/5f41c46c1a63e5e13bc6c59ed0471823 to your computer and use it in GitHub Desktop.
Save vicly/5f41c46c1a63e5e13bc6c59ed0471823 to your computer and use it in GitHub Desktop.
[AWS Monitoring Metrics and Logging] #AWS

Check out the CloudWatch Metrics and Dimensions

Custom Metrics

By default Amazon Linux get CLI installed

# Send custom metrics to CloudWatch (without dimensions)
aws cloudwatch put-metric-data --metric-nname MyFreeMemGB --namespace MyLinux --value 5 --region eu-west-1

# With dimensions
aws cloudwatch put-metric-data --metric-nname MyFreeMemGB --namespace MyLinux --value 5 --region eu-west-1 -=dimensions 'Name=Server,Value=LIN'


#
# AWS EC2 cloudwatch monitoring script: http://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.1.zip
# How to use? see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html?shortFooter=true#using_put_script
./mon-put-instance-data.ps --mem-util --mem-used --mem-avail

# create a cron job run every 5 mins
crontab -e
*/5 * * * * ~/aws-scripts-mon/mon-put-instance-data.pl --mem-used-incl-cache-buff --mem-util --disk-space-util --disk-path=/ --from-cron
!wq

# check by listing all cron jobs
crontab -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment