Advertisement
loudmouthman

AWS Command line metrics EC2 and Loadbalancer

Jan 24th, 2016
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.70 KB | None | 0 0
  1. Some notes on getting AWS Command line working
  2. # aws needs the instance date/time to be accurate before communication begins. Further you need to configure the AWS Command line client before you proceed to ensure it has the relevant
  3. ntpdate uk.pool.ntp.org
  4.  
  5. STRT=$(date +%Y-%m-%dT%H:00:00 -d '1 hour ago')
  6. END=$(date +%Y-%m-%dT%H:00:00)
  7.  
  8.  
  9. #take note of Name Spaces when attempting to access Dimensions.
  10.  
  11. APACHECPU
  12. aws cloudwatch get-metric-statistics --metric-name CPUUtilization --start-time=${STRT}  --end-time=${END} --period 3600 --statistics Average   --namespace AWS/EC2 --dimensions Name=InstanceId,Value=i-nstanceid
  13.  
  14. APACHEIN
  15. aws cloudwatch get-metric-statistics --metric-name NetworkIn --start-time=${STRT}  --end-time=${END} --period 3600 --statistics Sum   --namespace AWS/EC2 --dimensions Name=InstanceId,Value=i-nstanceid
  16.  
  17.  
  18. LBREQUESTS
  19. aws cloudwatch get-metric-statistics --metric-name RequestCount --start-time=${STRT}  --end-time=${END} --period 3600 --statistics Sum --namespace AWS/ELB --dimensions Name=LoadBalancerName,Value=lbname
  20.  
  21. LB2XX
  22. aws cloudwatch get-metric-statistics --metric-name HTTPCode_Backend_2XX  --start-time=${STRT}  --end-time=${END} --period 3600 --statistics Sum --namespace AWS/ELB --dimensions Name=LoadBalancerName,Value=lbname
  23.  
  24. LB4XX
  25. aws cloudwatch get-metric-statistics --metric-name HTTPCode_Backend_4XX --start-time=${STRT}  --end-time=${END} --period 3600 --statistics Sum --namespace AWS/ELB --dimensions Name=LoadBalancerName,Value=lbname
  26.  
  27. LB5XX
  28. aws cloudwatch get-metric-statistics --metric-name HTTPCode_Backend_5XX --start-time=${STRT}  --end-time=${END} --period 3600 --statistics Sum --namespace AWS/ELB --dimensions Name=LoadBalancerName,Value=lbname
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement