Class: Fog::Rackspace::Monitoring::DataPoints
- Inherits:
-
Collection
- Object
- Collection
- Fog::Rackspace::Monitoring::DataPoints
- Defined in:
- lib/fog/rackspace/models/monitoring/data_points.rb
Instance Method Summary collapse
- #all ⇒ Object
-
#fetch(options = {}) ⇒ Object
Fetch the datapoints for a metric ==== Parameters.
- #new(attributes = {}) ⇒ Object
Instance Method Details
#all ⇒ Object
12 13 14 |
# File 'lib/fog/rackspace/models/monitoring/data_points.rb', line 12 def all self.fetch(:resolution => :full) end |
#fetch(options = {}) ⇒ Object
Fetch the datapoints for a metric
Parameters
-
options<~Hash> - optional paramaters
-
from<~Integer> - timestamp in milliseconds
-
to<~Integer> - timestamp in milliseconds
-
points<~Integer> - Number of points to fetch
-
resolution<~String> - Should be one of :full, :min5, :min20, :min60, :min240, :min1440
-
select<~Array> - Should be an array of :average, :max, :min, :variance
-
Returns
-
datapoints<~Fog::Rackspace::Monitoring::Datapoints>:
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fog/rackspace/models/monitoring/data_points.rb', line 28 def fetch(={}) requires :metric [:from] ||= (Time.now.to_i * 1000) - (3600 * 1000) [:to] ||= Time.now.to_i * 1000 [:points] ||= 1 unless [:resolution] if [:resolution] [:resolution] = [:resolution].upcase end data = service.list_data_points(metric.check.entity.id, metric.check.id, metric.name, ).body['values'] load(data) end |
#new(attributes = {}) ⇒ Object
40 41 42 43 |
# File 'lib/fog/rackspace/models/monitoring/data_points.rb', line 40 def new(attributes = {}) requires :metric super({ :metric => metric }.merge!(attributes)) end |