Class: Nagira::ServicegroupController::Member

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/servicegroups_controller.rb

Overview

Single member of servicegroup. In Nagios configuration it is defined as “<hostname>,<service>”. Contructor takes straing as argument.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ Member

Returns a new instance of Member.



10
11
12
13
14
# File 'app/controllers/servicegroups_controller.rb', line 10

def initialize(string)
  member = string.split ","
  @hostname = member.first
  @servicename = member.last
end

Instance Attribute Details

#hostnameObject (readonly)

Returns the value of attribute hostname.



15
16
17
# File 'app/controllers/servicegroups_controller.rb', line 15

def hostname
  @hostname
end

#servicenameObject (readonly)

Returns the value of attribute servicename.



15
16
17
# File 'app/controllers/servicegroups_controller.rb', line 15

def servicename
  @servicename
end

Instance Method Details

#serviceObject



17
18
19
# File 'app/controllers/servicegroups_controller.rb', line 17

def service
  @service ||= Nagira::HostService.new(hostname,servicename)
end

#stateObject



24
25
26
# File 'app/controllers/servicegroups_controller.rb', line 24

def state
  service.state
end

#statusObject



20
21
22
# File 'app/controllers/servicegroups_controller.rb', line 20

def status
  service.status
end