Zend_Service_Amazon_Ec2-CloudWatch.xml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.service.amazon.ec2.cloudwatch">
  4. <title>Zend_Service_Amazon_Ec2: CloudWatch Monitoring</title>
  5. <para>
  6. Amazon CloudWatch is an easy-to-use web service that provides
  7. comprehensive monitoring for Amazon Elastic Compute Cloud (Amazon
  8. <acronym>EC2</acronym>) and Elastic Load Balancing. For more details information
  9. check out the <ulink
  10. url="http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/Welcome.html">
  11. Amazon CloudWatch Developers Guide</ulink>
  12. </para>
  13. <sect2 id="zend.service.amazon.ec2.cloudwatch.usage">
  14. <title>CloudWatch Usage</title>
  15. <example id="zend.service.amazon.ec2.cloudwatch.usage.list">
  16. <title>Listing Aviable Metrics</title>
  17. <para>
  18. <methodname>listMetrics()</methodname> returns a list of up to 500 valid metrics for
  19. which there is recorded data available to a you and a NextToken string
  20. that can be used to query for the next set of results.
  21. </para>
  22. <programlisting language="php"><![CDATA[
  23. $ec2_ebs = new Zend_Service_Amazon_Ec2_CloudWatch('aws_key','aws_secret_key');
  24. $return = $ec2_ebs->listMetrics();
  25. ]]></programlisting>
  26. </example>
  27. <example id="zend.service.amazon.ec2.cloudwatch.usage.getmetricstatistics">
  28. <title>Return Statistics for a given metric</title>
  29. <para>
  30. <methodname>getMetricStatistics()</methodname> Returns data for one or more
  31. statistics of given a metric.
  32. </para>
  33. <para>
  34. <note>
  35. <para>
  36. The maximum number of datapoints that the Amazon CloudWatch service will
  37. return in a single GetMetricStatistics request is 1,440. If a request is
  38. made that would generate more datapoints than this amount, Amazon CloudWatch
  39. will return an error. You can alter your request by narrowing the time range
  40. (StartTime, EndTime) or increasing the Period in your single request. You
  41. may also get all of the data at the granularity you originally asked for
  42. by making multiple requests with adjacent time ranges.
  43. </para>
  44. </note>
  45. </para>
  46. <para>
  47. <methodname>getMetricStatistics()</methodname> only requires two parameters but it
  48. also has four additional parameters that are optional.
  49. </para>
  50. <itemizedlist>
  51. <listitem>
  52. <para><emphasis>Required:</emphasis></para>
  53. </listitem>
  54. <listitem>
  55. <para>
  56. <emphasis>MeasureName</emphasis> The measure name that corresponds to
  57. the measure for the gathered metric. Valid <acronym>EC2</acronym> Values are
  58. <acronym>CPU</acronym>Utilization, NetworkIn, NetworkOut, DiskWriteOps
  59. DiskReadBytes, DiskReadOps, DiskWriteBytes. Valid Elastic
  60. Load Balancing Metrics are Latency, RequestCount, HealthyHostCount
  61. UnHealthyHostCount. <ulink
  62. url="http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html#ec2-metricscollected">For
  63. more information click here</ulink>
  64. </para>
  65. </listitem>
  66. <listitem>
  67. <para>
  68. <emphasis>Statistics</emphasis> The statistics to be returned for the given
  69. metric. Valid values are Average, Maximum, Minimum, Samples, Sum. You can
  70. specify this as a string or as an array of values. If you don't specify one
  71. it will default to Average instead of failing out. If you specify an
  72. incorrect option it will just skip it. <ulink
  73. url="http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/US_GetStatistics.html">For
  74. more information click here</ulink>
  75. </para>
  76. </listitem>
  77. <listitem>
  78. <para><emphasis>Optional:</emphasis></para>
  79. </listitem>
  80. <listitem>
  81. <para>
  82. <emphasis>Dimensions</emphasis> Amazon CloudWatch allows you to specify one
  83. Dimension to further filter metric data on. If you don't specify a
  84. dimension, the service returns the aggregate of all the measures with the
  85. given measure name and time range.
  86. </para>
  87. </listitem>
  88. <listitem>
  89. <para>
  90. <emphasis>Unit</emphasis> The standard unit of Measurement for a given
  91. Measure. Valid Values: Seconds, Percent, Bytes, Bits, Count, Bytes/Second,
  92. Bits/Second, Count/Second, and None. Constraints: When using count/second
  93. as the unit, you should use Sum as the statistic instead of Average.
  94. Otherwise, the sample returns as equal to the number of requests
  95. instead of the number of 60-second intervals. This will cause the Average
  96. to always equals one when the unit is count/second.
  97. </para>
  98. </listitem>
  99. <listitem>
  100. <para>
  101. <emphasis>StartTime</emphasis> The timestamp of the first datapoint to
  102. return, inclusive. For example, 2008-02-26T19:00:00+00:00. We round your
  103. value down to the nearest minute. You can set your start time for more than
  104. two weeks in the past. However, you will only get data for the past two
  105. weeks. (in <acronym>ISO</acronym> 8601 format). Constraints: Must be before
  106. EndTime.
  107. </para>
  108. </listitem>
  109. <listitem>
  110. <para>
  111. <emphasis>EndTime</emphasis> The timestamp to use for determining the last
  112. datapoint to return. This is the last datapoint to fetch, exclusive. For
  113. example, 2008-02-26T20:00:00+00:00 (in <acronym>ISO</acronym> 8601 format).
  114. </para>
  115. </listitem>
  116. </itemizedlist>
  117. <programlisting language="php"><![CDATA[
  118. $ec2_ebs = new Zend_Service_Amazon_Ec2_CloudWatch('aws_key','aws_secret_key');
  119. $return = $ec2_ebs->getMetricStatistics(
  120. array('MeasureName' => 'NetworkIn',
  121. 'Statistics' => array('Average')));
  122. ]]></programlisting>
  123. </example>
  124. </sect2>
  125. </sect1>