Amazon CloudWatch Interface for Common Lisp
To complement our Common Lisp EC2 interface, I’ve written a similar package for Amazon’s CloudWatch, an “easy-to-use web service that provides comprehensive monitoring for Amazon Elastic Compute Cloud (Amazon EC2) and Elastic Load Balancing”. There are currently just two operations provided by CloudWatch: ListMetrics and GetMetricStatistics, both of which are supported by our new package.
The CloudWatch Lisp interface has some work remaining; mostly just parsing the responses from Amazon into more useful representations of the metrics (similar to the way we transform EC2 responses). Since GetMetricStatistics can return a lot of information, I’ll have to decide how best to represent this data in an easy-to-use, Lispy fashion. At present, the CloudWatch responses are filtered through the s-xml package and returned in a “parsed-xml” format.
For the curious, here’s a peek at how we use our CloudWatch API via the Lisp REPL; remember, the response format you see here will change in the near future, as might the Lisp interface itself:
SIERRA(75): (cw:get-metric-statistics "CPUUtilization" "2010-02-04T00:00:00" "2010-03-04T00:00:00"
:dimensions '(("InstanceId" . "i-e4c5d78c")) :period 3600
:statistics '("Average" "Minimum" "Maximum"))
((CLOUDWATCH:|GetMetricStatisticsResponse| |xmlns|
"http://monitoring.amazonaws.com/doc/2009-05-15/")
(CLOUDWATCH:|GetMetricStatisticsResult|
(CLOUDWATCH:|Datapoints|
(CLOUDWATCH:|member| (CLOUDWATCH:|Timestamp| "2010-02-04T15:00:00Z")
(CLOUDWATCH:|Unit| "Percent") (CLOUDWATCH:|Minimum| "0.33")
(CLOUDWATCH:|Maximum| "42.16") (CLOUDWATCH:|Samples| "21.0")
(CLOUDWATCH:|Average| "4.019523809523808"))
(CLOUDWATCH:|member| (CLOUDWATCH:|Timestamp| "2010-02-04T17:00:00Z")
(CLOUDWATCH:|Unit| "Percent") (CLOUDWATCH:|Minimum| "0.33")
(CLOUDWATCH:|Maximum| "0.67") (CLOUDWATCH:|Samples| "60.0")
(CLOUDWATCH:|Average| "0.43283333333333357"))
(CLOUDWATCH:|member| (CLOUDWATCH:|Timestamp| "2010-02-04T16:00:00Z")
(CLOUDWATCH:|Unit| "Percent") (CLOUDWATCH:|Minimum| "0.33")
(CLOUDWATCH:|Maximum| "54.83") (CLOUDWATCH:|Samples| "60.0")
(CLOUDWATCH:|Average| "1.5139999999999998"))
(CLOUDWATCH:|member| (CLOUDWATCH:|Timestamp| "2010-02-04T18:00:00Z")
(CLOUDWATCH:|Unit| "Percent") (CLOUDWATCH:|Minimum| "0.33")
(CLOUDWATCH:|Maximum| "2.43") (CLOUDWATCH:|Samples| "52.0")
(CLOUDWATCH:|Average| "0.46769230769230763")))
(CLOUDWATCH:|Label| "CPUUtilization"))
(CLOUDWATCH:|ResponseMetadata|
(CLOUDWATCH:|RequestId| "2fe43748-11c1-11df-804b-85d5ecf228e7")))
SIERRA(76):
I’ll post periodically as our CloudWatch package evolves. In the meantime, if you have suggestions as to how you’d like to see the metrics represented or Lisp interface improved, just drop me a line.
Tags: amazon, cloudwatch, lisp
This entry was posted on Thursday, February 4th, 2010 at 2:37 pm and is filed under SaffronSierra. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Leave a Reply

