Class: Nagira::Servicegroup::Member

Inherits:
Object
  • Object
show all
Defined in:
lib/nagira/servicegroup.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

- (Member) initialize(string)

Returns a new instance of Member



10
11
12
13
14
# File 'lib/nagira/servicegroup.rb', line 10

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

Instance Attribute Details

- (Object) hostname (readonly)

Returns the value of attribute hostname



15
16
17
# File 'lib/nagira/servicegroup.rb', line 15

def hostname
  @hostname
end

- (Object) servicename (readonly)

Returns the value of attribute servicename



15
16
17
# File 'lib/nagira/servicegroup.rb', line 15

def servicename
  @servicename
end

Instance Method Details

- (Object) service



17
18
19
# File 'lib/nagira/servicegroup.rb', line 17

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

- (Object) state



24
25
26
# File 'lib/nagira/servicegroup.rb', line 24

def state
  service.state
end

- (Object) status



20
21
22
# File 'lib/nagira/servicegroup.rb', line 20

def status
  service.status
end