Skip to content

Instantly share code, notes, and snippets.

@charusat09
Created December 31, 2018 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charusat09/d42fd76129a664028725ec09b81a07db to your computer and use it in GitHub Desktop.
Save charusat09/d42fd76129a664028725ec09b81a07db to your computer and use it in GitHub Desktop.
#!/bin/bash
USEDMEMORY=$(free -m | awk 'NR==2{printf "%.2f\t", $3*100/$2 }')
TCP_CONN=$(netstat -an | wc -l)
TCP_CONN_PORT_80=$(netstat -an | grep 80 | wc -l)
USERS=$(uptime |awk '{ print $6 }')
IO_WAIT=$(iostat | awk 'NR==4 {print $5}')
aws cloudwatch put-metric-data --metric-name memory-usage --dimensions AutoScalingGroupName=RailsAlpha --namespace "Custom" --value $USEDMEMORY --region us-west-2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment