daily pastebin goal
27%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. export PATH='/usr/local/bin:/usr/bin:/bin'
  4. mem_total=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`
  5. mem_avail=`cat /proc/meminfo | grep MemFree | awk '{print $2}'`
  6. mem_used=`expr $mem_total - $mem_avail`
  7. mem_pct=`awk "BEGIN {print 100*($mem_used/$mem_total)}"`
  8. instance_id=`curl -s http://169.254.169.254/latest/meta-data/instance-id`
  9. sleep "$((RANDOM%20))"
  10. aws --region us-east-1 cloudwatch put-metric-data --namespace System/Linux --metric-name MemoryUtilization --unit Percent --dimensions InstanceId=$instance_id --value $mem_pct
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top