Class: Fog::Rackspace::Monitoring::Real

Inherits:
Service
  • Object
show all
Defined in:
lib/fog/rackspace/monitoring.rb,
lib/fog/rackspace/requests/monitoring/get_agent.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_agents.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/get_cpus_info.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_disks_info.rb,
lib/fog/rackspace/requests/monitoring/get_agent_token.rb,
lib/fog/rackspace/requests/monitoring/get_memory_info.rb,
lib/fog/rackspace/requests/monitoring/get_system_info.rb,
lib/fog/rackspace/requests/monitoring/get_notification.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/get_processes_info.rb,
lib/fog/rackspace/requests/monitoring/list_notifications.rb,
lib/fog/rackspace/requests/monitoring/create_notification.rb,
lib/fog/rackspace/requests/monitoring/delete_notification.rb,
lib/fog/rackspace/requests/monitoring/get_monitoring_zone.rb,
lib/fog/rackspace/requests/monitoring/list_alarm_examples.rb,
lib/fog/rackspace/requests/monitoring/update_notification.rb,
lib/fog/rackspace/requests/monitoring/get_filesystems_info.rb,
lib/fog/rackspace/requests/monitoring/list_monitoring_zones.rb,
lib/fog/rackspace/requests/monitoring/evaluate_alarm_example.rb,
lib/fog/rackspace/requests/monitoring/get_logged_in_user_info.rb,
lib/fog/rackspace/requests/monitoring/list_notification_plans.rb,
lib/fog/rackspace/requests/monitoring/get_network_interfaces_info.rb

Instance Method Summary collapse

Methods inherited from Service

#request_without_retry, #service_net?

Constructor Details

#initialize(options = {}) ⇒ Real

Returns a new instance of Real.



133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/fog/rackspace/monitoring.rb', line 133

def initialize(options={})
  @rackspace_api_key = options[:rackspace_api_key]
  @rackspace_username = options[:rackspace_username]
  @rackspace_auth_url = options[:rackspace_auth_url]
  @connection_options = options[:connection_options] || {}
  @rackspace_endpoint = Fog::Rackspace.normalize_url(options[:rackspace_monitoring_url])

  authenticate

  @persistent = options[: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(options = {})
  data = options.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, options = {})
  data = options.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, options = {})
  data = options.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(options = {})
  data = options.dup
  request(
    :body     => JSON.encode(data),
    :expects  => [201],
    :method   => 'POST',
    :path     => 'entities'
  )
end

#create_notification(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/fog/rackspace/requests/monitoring/create_notification.rb', line 5

def create_notification(options = {})
  data = options.dup
  request(
    :body     => JSON.encode(data),
    :expects  => [201],
    :method   => 'POST',
    :path     => 'notifications'
  )
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

#delete_notification(notification_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/rackspace/requests/monitoring/delete_notification.rb', line 5

def delete_notification(notification_id)
  request(
    :expects  => [204],
    :method   => 'DELETE',
    :path     => "notifications/#{notification_id}"
  )
end

#endpoint_uri(service_endpoint_url = nil) ⇒ Object



150
151
152
# File 'lib/fog/rackspace/monitoring.rb', line 150

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, options = {})
  options ||= {}
  data = {:values => options.dup}
  request(
    :body     => JSON.encode(data),
    :expects  => [200],
    :method   => 'POST',
    :path     => "alarm_examples/#{id}"
  )
end

#get_agent(agent_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/rackspace/requests/monitoring/get_agent.rb', line 5

def get_agent(agent_id)
  request(
    :expects  => [200, 203],
    :method   => 'GET',
    :path     => "agents/#{agent_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_cpus_info(agent_id) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/rackspace/requests/monitoring/get_cpus_info.rb', line 6

def get_cpus_info(agent_id)
  request(
    :expects  => [200, 203],
    :method   => 'GET',
    :path     => "agents/#{agent_id}/host_info/cpus"
  )
end

#get_disks_info(agent_id) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/rackspace/requests/monitoring/get_disks_info.rb', line 6

def get_disks_info(agent_id)
  request(
    :expects  => [200, 203],
    :method   => 'GET',
    :path     => "agents/#{agent_id}/host_info/disks"
  )
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

#get_filesystems_info(agent_id) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/rackspace/requests/monitoring/get_filesystems_info.rb', line 6

def get_filesystems_info(agent_id)
  request(
    :expects  => [200, 203],
    :method   => 'GET',
    :path     => "agents/#{agent_id}/host_info/filesystems"
  )
end

#get_logged_in_user_info(agent_id) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/rackspace/requests/monitoring/get_logged_in_user_info.rb', line 6

def (agent_id)
  request(
    :expects  => [200, 203],
    :method   => 'GET',
    :path     => "agents/#{agent_id}/host_info/who"
  )
end

#get_memory_info(agent_id) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/rackspace/requests/monitoring/get_memory_info.rb', line 6

def get_memory_info(agent_id)
  request(
    :expects  => [200, 203],
    :method   => 'GET',
    :path     => "agents/#{agent_id}/host_info/memory"
  )
end

#get_monitoring_zone(by_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/rackspace/requests/monitoring/get_monitoring_zone.rb', line 5

def get_monitoring_zone by_id
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "monitoring_zones/#{by_id}"
  )
end

#get_network_interfaces_info(agent_id) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/rackspace/requests/monitoring/get_network_interfaces_info.rb', line 6

def get_network_interfaces_info(agent_id)
  request(
    :expects  => [200, 203],
    :method   => 'GET',
    :path     => "agents/#{agent_id}/host_info/network_interfaces"
  )
end

#get_notification(notification_id) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/rackspace/requests/monitoring/get_notification.rb', line 6

def get_notification(notification_id)
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "notifications/#{notification_id}"
  )
end

#get_processes_info(agent_id) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/rackspace/requests/monitoring/get_processes_info.rb', line 6

def get_processes_info(agent_id)
  request(
    :expects  => [200, 203],
    :method   => 'GET',
    :path     => "agents/#{agent_id}/host_info/processes"
  )
end

#get_system_info(agent_id) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/rackspace/requests/monitoring/get_system_info.rb', line 6

def get_system_info(agent_id)
  request(
    :expects  => [200, 203],
    :method   => 'GET',
    :path     => "agents/#{agent_id}/host_info/system"
  )
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(options={})
  request(
    :expects  => [200, 203],
    :method   => 'GET',
    :path     => 'agent_tokens',
    :query    => options
  )
end

#list_agentsObject



5
6
7
8
9
10
11
# File 'lib/fog/rackspace/requests/monitoring/list_agents.rb', line 5

def list_agents
  request(
    :expects  => [200, 203],
    :method   => 'GET',
    :path     => "agents"
  )
end

#list_alarm_examplesObject



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_typesObject



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, options)
  request(
    :expects  => [200, 203],
    :method   => 'GET',
    :path     => "entities/#{entity_id}/checks/#{check_id}/metrics/#{metric_name}/plot",
    :query    => options
  )
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(options={})
  request(
    :expects  => [200, 203],
    :method   => 'GET',
    :path     => 'entities',
    :query    => options
  )
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_monitoring_zonesObject



5
6
7
8
9
10
11
# File 'lib/fog/rackspace/requests/monitoring/list_monitoring_zones.rb', line 5

def list_monitoring_zones
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "monitoring_zones"
  )
end

#list_notification_plansObject



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_notifications(options = {}) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/fog/rackspace/requests/monitoring/list_notifications.rb', line 6

def list_notifications(options={})
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "notifications",
    :query    => options
  )
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(options={})
  request(
    :expects  => [200, 203],
    :method   => 'GET',
    :path     => "views/overview",
    :query    => options
  )
end

#regionObject



129
130
131
# File 'lib/fog/rackspace/monitoring.rb', line 129

def region
  @rackspace_region
end

#reloadObject



146
147
148
# File 'lib/fog/rackspace/monitoring.rb', line 146

def reload
  @connection.reset
end

#request_id_headerObject



154
155
156
# File 'lib/fog/rackspace/monitoring.rb', line 154

def request_id_header
 "X-Response-Id"
end

#service_nameObject



125
126
127
# File 'lib/fog/rackspace/monitoring.rb', line 125

def service_name
  :cloudMonitoring
end

#update_alarm(entity_id, alarm_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, alarm_id, options)
  request(
    :body     => JSON.encode(options),
    :expects  => [204],
    :method   => 'PUT',
    :path     => "entities/#{entity_id}/alarms/#{alarm_id}"
  )
end

#update_check(entity_id, check_id, options) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/fog/rackspace/requests/monitoring/update_check.rb', line 6

def update_check(entity_id, check_id, options)
  request(
    :body     => JSON.encode(options),
    :expects  => [204],
    :method   => 'PUT',
    :path     => "entities/#{entity_id}/checks/#{check_id}"
  )
end

#update_entity(entity_id, options) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/fog/rackspace/requests/monitoring/update_entity.rb', line 6

def update_entity(entity_id, options)
  request(
    :body     => JSON.encode(options),
    :expects  => [204],
    :method   => 'PUT',
    :path     => "entities/#{entity_id}"
  )
end

#update_notification(id, options) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/rackspace/requests/monitoring/update_notification.rb', line 5

def update_notification(id, options)
  request(
    :body     => JSON.encode(options),
    :expects  => [204],
    :method   => 'PUT',
    :path     => "notifications/#{id}"
  )
end