Class: Fog::Rackspace::Monitoring::Real
- Defined in:
- lib/fog/rackspace/monitoring.rb,
lib/fog/rackspace/requests/monitoring/get_alarm.rb,
lib/fog/rackspace/requests/monitoring/get_check.rb,
lib/fog/rackspace/requests/monitoring/get_entity.rb,
lib/fog/rackspace/requests/monitoring/list_alarms.rb,
lib/fog/rackspace/requests/monitoring/list_checks.rb,
lib/fog/rackspace/requests/monitoring/create_alarm.rb,
lib/fog/rackspace/requests/monitoring/create_check.rb,
lib/fog/rackspace/requests/monitoring/delete_alarm.rb,
lib/fog/rackspace/requests/monitoring/delete_check.rb,
lib/fog/rackspace/requests/monitoring/list_metrics.rb,
lib/fog/rackspace/requests/monitoring/update_alarm.rb,
lib/fog/rackspace/requests/monitoring/update_check.rb,
lib/fog/rackspace/requests/monitoring/create_entity.rb,
lib/fog/rackspace/requests/monitoring/delete_entity.rb,
lib/fog/rackspace/requests/monitoring/list_entities.rb,
lib/fog/rackspace/requests/monitoring/list_overview.rb,
lib/fog/rackspace/requests/monitoring/update_entity.rb,
lib/fog/rackspace/requests/monitoring/get_agent_token.rb,
lib/fog/rackspace/requests/monitoring/list_check_types.rb,
lib/fog/rackspace/requests/monitoring/list_data_points.rb,
lib/fog/rackspace/requests/monitoring/get_alarm_example.rb,
lib/fog/rackspace/requests/monitoring/list_agent_tokens.rb,
lib/fog/rackspace/requests/monitoring/create_agent_token.rb,
lib/fog/rackspace/requests/monitoring/delete_agent_token.rb,
lib/fog/rackspace/requests/monitoring/list_alarm_examples.rb,
lib/fog/rackspace/requests/monitoring/evaluate_alarm_example.rb,
lib/fog/rackspace/requests/monitoring/list_notification_plans.rb
Instance Method Summary collapse
- #create_agent_token(options = {}) ⇒ Object
- #create_alarm(entity_id, options = {}) ⇒ Object
- #create_check(entity_id, options = {}) ⇒ Object
- #create_entity(options = {}) ⇒ Object
- #delete_agent_token(token_id) ⇒ Object
- #delete_alarm(entity_id, alarm_id) ⇒ Object
- #delete_check(entity_id, check_id) ⇒ Object
- #delete_entity(entity_id) ⇒ Object
- #endpoint_uri(service_endpoint_url = nil) ⇒ Object
- #evaluate_alarm_example(id, options = {}) ⇒ Object
- #get_agent_token(id) ⇒ Object
- #get_alarm(entity_id, alarm_id) ⇒ Object
- #get_alarm_example(id) ⇒ Object
- #get_check(entity_id, check_id) ⇒ Object
- #get_entity(entity_id) ⇒ Object
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
- #list_agent_tokens(options = {}) ⇒ Object
- #list_alarm_examples ⇒ Object
- #list_alarms(entity_id) ⇒ Object
- #list_check_types ⇒ Object
- #list_checks(entity_id) ⇒ Object
- #list_data_points(entity_id, check_id, metric_name, options) ⇒ Object
- #list_entities(options = {}) ⇒ Object
- #list_metrics(entity_id, check_id) ⇒ Object
- #list_notification_plans ⇒ Object
- #list_overview(options = {}) ⇒ Object
- #region ⇒ Object
- #reload ⇒ Object
- #service_name ⇒ Object
- #update_alarm(entity_id, id, options) ⇒ Object
- #update_check(entity_id, id, options) ⇒ Object
- #update_entity(id, options) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/fog/rackspace/monitoring.rb', line 98 def initialize(={}) @rackspace_api_key = [:rackspace_api_key] @rackspace_username = [:rackspace_username] @rackspace_auth_url = [:rackspace_auth_url] @connection_options = [:connection_options] || {} @rackspace_endpoint = Fog::Rackspace.normalize_url([:rackspace_monitoring_url]) authenticate @persistent = [:persistent] || false @connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options) end |
Instance Method Details
#create_agent_token(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/rackspace/requests/monitoring/create_agent_token.rb', line 6 def create_agent_token( = {}) data = .dup request( :body => JSON.encode(data), :expects => [201], :method => 'POST', :path => 'agent_tokens' ) end |
#create_alarm(entity_id, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/rackspace/requests/monitoring/create_alarm.rb', line 6 def create_alarm(entity_id, = {}) data = .dup request( :body => JSON.encode(data), :expects => [201], :method => 'POST', :path => "entities/#{entity_id}/alarms" ) end |
#create_check(entity_id, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/rackspace/requests/monitoring/create_check.rb', line 6 def create_check(entity_id, = {}) data = .dup request( :body => JSON.encode(data), :expects => [201], :method => 'POST', :path => "entities/#{entity_id}/checks" ) end |
#create_entity(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/rackspace/requests/monitoring/create_entity.rb', line 6 def create_entity( = {}) data = .dup request( :body => JSON.encode(data), :expects => [201], :method => 'POST', :path => 'entities' ) end |
#delete_agent_token(token_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/monitoring/delete_agent_token.rb', line 6 def delete_agent_token(token_id) request( :expects => [204], :method => 'DELETE', :path => "agent_tokens/#{token_id}" ) end |
#delete_alarm(entity_id, alarm_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/monitoring/delete_alarm.rb', line 6 def delete_alarm(entity_id, alarm_id) request( :expects => [204], :method => 'DELETE', :path => "entities/#{entity_id}/alarms/#{alarm_id}" ) end |
#delete_check(entity_id, check_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/monitoring/delete_check.rb', line 6 def delete_check(entity_id, check_id) request( :expects => [204], :method => 'DELETE', :path => "entities/#{entity_id}/checks/#{check_id}" ) end |
#delete_entity(entity_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/monitoring/delete_entity.rb', line 6 def delete_entity(entity_id) request( :expects => [204], :method => 'DELETE', :path => "entities/#{entity_id}" ) end |
#endpoint_uri(service_endpoint_url = nil) ⇒ Object
115 116 117 |
# File 'lib/fog/rackspace/monitoring.rb', line 115 def endpoint_uri(service_endpoint_url=nil) @uri = super(@rackspace_endpoint || service_endpoint_url, :rackspace_monitoring_url) end |
#evaluate_alarm_example(id, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fog/rackspace/requests/monitoring/evaluate_alarm_example.rb', line 6 def evaluate_alarm_example(id, = {}) ||= {} data = {:values => .dup} request( :body => JSON.encode(data), :expects => [200], :method => 'POST', :path => "alarm_examples/#{id}" ) end |
#get_agent_token(id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/monitoring/get_agent_token.rb', line 6 def get_agent_token(id) request( :expects => [200, 203], :method => 'GET', :path => "agent_tokens/#{id}" ) end |
#get_alarm(entity_id, alarm_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/monitoring/get_alarm.rb', line 6 def get_alarm(entity_id, alarm_id) request( :expects => [200, 203], :method => 'GET', :path => "entities/#{entity_id}/alarms/#{alarm_id}" ) end |
#get_alarm_example(id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/monitoring/get_alarm_example.rb', line 6 def get_alarm_example(id) request( :expects => [200, 203], :method => 'GET', :path => "alarm_examples/#{id}" ) end |
#get_check(entity_id, check_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/monitoring/get_check.rb', line 6 def get_check(entity_id, check_id) request( :expects => [200, 203], :method => 'GET', :path => "entities/#{entity_id}/checks/#{check_id}" ) end |
#get_entity(entity_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/monitoring/get_entity.rb', line 6 def get_entity(entity_id) request( :expects => [200, 203], :method => 'GET', :path => "entities/#{entity_id}" ) end |
#list_agent_tokens(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/fog/rackspace/requests/monitoring/list_agent_tokens.rb', line 6 def list_agent_tokens(={}) request( :expects => [200, 203], :method => 'GET', :path => 'agent_tokens', :query => ) end |
#list_alarm_examples ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/monitoring/list_alarm_examples.rb', line 6 def list_alarm_examples request( :expects => [200, 203], :method => 'GET', :path => 'alarm_examples' ) end |
#list_alarms(entity_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/monitoring/list_alarms.rb', line 6 def list_alarms(entity_id) request( :expects => [200, 203], :method => 'GET', :path => "entities/#{entity_id}/alarms" ) end |
#list_check_types ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/monitoring/list_check_types.rb', line 6 def list_check_types request( :expects => [200, 203], :method => 'GET', :path => "check_types" ) end |
#list_checks(entity_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/monitoring/list_checks.rb', line 6 def list_checks(entity_id) request( :expects => [200, 203], :method => 'GET', :path => "entities/#{entity_id}/checks" ) end |
#list_data_points(entity_id, check_id, metric_name, options) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/fog/rackspace/requests/monitoring/list_data_points.rb', line 6 def list_data_points(entity_id, check_id, metric_name, ) request( :expects => [200, 203], :method => 'GET', :path => "entities/#{entity_id}/checks/#{check_id}/metrics/#{metric_name}/plot", :query => ) end |
#list_entities(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/fog/rackspace/requests/monitoring/list_entities.rb', line 6 def list_entities(={}) request( :expects => [200, 203], :method => 'GET', :path => 'entities', :query => ) end |
#list_metrics(entity_id, check_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/monitoring/list_metrics.rb', line 6 def list_metrics(entity_id, check_id) request( :expects => [200, 203], :method => 'GET', :path => "entities/#{entity_id}/checks/#{check_id}/metrics" ) end |
#list_notification_plans ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/monitoring/list_notification_plans.rb', line 6 def list_notification_plans request( :expects => [200], :method => 'GET', :path => "notification_plans" ) end |
#list_overview(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/fog/rackspace/requests/monitoring/list_overview.rb', line 6 def list_overview(={}) request( :expects => [200, 203], :method => 'GET', :path => "views/overview", :query => ) end |
#region ⇒ Object
94 95 96 |
# File 'lib/fog/rackspace/monitoring.rb', line 94 def region @rackspace_region end |
#reload ⇒ Object
111 112 113 |
# File 'lib/fog/rackspace/monitoring.rb', line 111 def reload @connection.reset end |
#service_name ⇒ Object
90 91 92 |
# File 'lib/fog/rackspace/monitoring.rb', line 90 def service_name :cloudMonitoring end |
#update_alarm(entity_id, id, options) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/fog/rackspace/requests/monitoring/update_alarm.rb', line 6 def update_alarm(entity_id, id, ) request( :body => JSON.encode(), :expects => [204], :method => 'PUT', :path => "entities/#{entity_id}/alarms/#{id}" ) end |