Zend_Service_Amazon_Ec2-CloudWatch.xml 6.3 KB

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