Cloudwatch - The In's and Out'sPresentation Transcript
CloudWatch the In’s and Out’sAWS-DC 2012-01-25
What is CloudWatch?
At its most basic -AWS instrumentation
Every AWS Service has “Metrics”: • ELB Front- and Back-end Response Codes • ElastiCache hits and misses • EBS IOPS • SQS Queue Length
Can even combine them
Every Metric can be converted into an Alarm
Alarms can take actions:• Send message through SNS• Trigger autoscaling
Even Better You can create your own metricsSo you can trigger your own events
TerminologyMetric - a time-ordered set of data pointsDimension - A name/value pair that helps you touniquely identify a metric. e.g.: EC2 InstanceIDNameSpace - containerStatistic Set - Aggregated set of data points (asoften as once per minute)
Example from the AWS tutorial: Pick an arbitrary set of data points• Hour one: 87, 51, 125, 235• Hour two: 121, 113, 189, 65, 89• Hour three: 100, 47, 133, 98, 100, 328
Hour 1 - Individual points Hour Raw Data 1 87 1 51 1 125 1 235
Hours 2&3 - Stat Sets Four predeﬁned keys: Sum, Minimum, Maximum, and SampleCount SampleHour Raw Data Sum Min Max Count 2 121,113,189,65,89 577 65 189 5 3 100,47,133,98,100,328 806 47 328 6
Push with CLI# For Hour 1# The unit of measurement is optionalmon-put-data -m RequestLatency -n "Nathan" -t 2012-01-24T11:00:00 -v 87 -u Millisecondsmon-put-data -m RequestLatency -n "Nathan" -t 2012-01-24T11:00:00 -v 51 -u Millisecondsmon-put-data -m RequestLatency -n "Nathan" -t 2012-01-24T11:00:00 -v 125 -u Millisecondsmon-put-data -m RequestLatency -n "Nathan" -t 2012-01-24T11:00:00 -v 235 -u Milliseconds# For Hour 2mon-put-data -m RequestLatency -n "Nathan" -t 2012-01-24T12:00:00 -s "Sum=577,Minimum=47,Maximum=189,SampleCount=5" -u Milliseconds# For Hour 3# If no timestamp is provided, it defaults to the current timemon-put-data -m RequestLatency -n "Nathan" -s "Sum=806,Minimum=47,Maximum=328,SampleCount=6" -u Milliseconds
When you use the mon-put-data command, you must use adate range within the past two weeks. There is currently nofunction to delete data points. Amazon CloudWatchautomatically deletes data points with a timestamp more thantwo weeks old.Can include --dimensions "x=y,u=v" in both puts and gets
Quirks of the ViewOne drawback to CloudWatch is that can be difﬁcult to understand the graphs
It’ll report what you ask for - Literally E.g. If you leave "Sum" selected and select "Healthy Host Count", it adds up all the data points supplied during the period selected. So instead of "10" you get "2500".
In this case youd want min, max or avg.
Have to experiment with different view parameters to get an accurate picture E.g.: ELB Response Codes - the data points dont represent numbers of coded responses during aperiod. Each one represents one instance of a code received. So to see the number of 2xx response codes for a period, you need to select the "Sum" statistic
If there arent enough data-points, it wont draw the connecting lines.
Amazon CloudWatch does not aggregate data across Regions List of available endpoints and regions: http://docs.amazonwebservices.com/general/latest/gr/rande.html?r=5025
Bottom line:Create information out of your system statistics and then act on it - automatically
Docs and ToolsDocumentation: http://aws.amazon.com/documentation/cloudwatch/CloudWatch CLI tools:Setup Page: http://docs.amazonwebservices.com/AmazonCloudWatch/latest/GettingStartedGuide/SetupCLI.htmlSet JAVA_HOME on OSX Lion: http://steveswinsburg.wordpress.com/2011/07/22/java_home-on-os-x-lion/Reference for AWS Service Metrics http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.htmlGreat How-To with Python and Boto: http://loggly.com/blog/2011/05/send-custom-metrics-to-cloudwatchs-api/
Contact Info Nathan McCourtney @beaknit gmail: beaknit