Method: Fog::AWS::CloudWatch::Real#get_metric_statistics
- Defined in:
- lib/fog/aws/requests/cloud_watch/get_metric_statistics.rb
permalink #get_metric_statistics(options = {}) ⇒ Object
Fetch datapoints for a metric. At most 1440 datapoints will be returned, the most datapoints that can be queried is 50850 StartTime is capped to 2 weeks ago
Options
-
Namespace<~String>: the namespace of the metric
-
MetricName<~String>: the name of the metric
-
StartTime<~Datetime>: when to start fetching datapoints from (inclusive)
-
EndTime<~Datetime>: used to determine the last datapoint to fetch (exclusive)
-
Period<~Integer>: Granularity, in seconds of the returned datapoints. Must be a multiple of 60, and at least 60
-
Statistics<~Array>: An array of up to 5 strings, which name the statistics to return
-
Unit<~String>: The unit for the metric
-
Dimensions<~Array>: a list of dimensions to filter against (optional)
Name : The name of the dimension Value : The value to filter against
Returns
-
response<~Excon::Response>:
See Also
docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/API_GetMetricStatistics.html
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/aws/requests/cloud_watch/get_metric_statistics.rb', line 27 def get_metric_statistics(={}) %w{Statistics StartTime EndTime Period MetricName Namespace}.each do |required_parameter| raise ArgumentError, "Must provide #{required_parameter}" unless .has_key?(required_parameter) end statistics = .delete 'Statistics' .merge!(AWS.indexed_param('Statistics.member.%d', [*statistics])) if dimensions = .delete('Dimensions') .merge!(AWS.indexed_param('Dimensions.member.%d.Name', dimensions.collect {|dimension| dimension['Name']})) .merge!(AWS.indexed_param('Dimensions.member.%d.Value', dimensions.collect {|dimension| dimension['Value']})) end request({ 'Action' => 'GetMetricStatistics', :parser => Fog::Parsers::AWS::CloudWatch::GetMetricStatistics.new }.merge()) end |