Class: Nagira::Hostgroup

Inherits:
Object
  • Object
show all
Defined in:
lib/nagira/hostgroup.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Hostgroup) initialize(name)

Returns a new instance of Hostgroup



5
6
7
8
9
10
11
# File 'lib/nagira/hostgroup.rb', line 5

def initialize(name)
  @name      = name
  @objects   = $nagios[:objects].objects
  @status    = $nagios[:status].status['hosts']
  @hostgroup = @objects[:hostgroup][name]
  @data  = {  }
end

Instance Attribute Details

- (Object) data (readonly)

Returns the value of attribute data



3
4
5
# File 'lib/nagira/hostgroup.rb', line 3

def data
  @data
end

- (Object) hostgroup (readonly)

Returns the value of attribute hostgroup



3
4
5
# File 'lib/nagira/hostgroup.rb', line 3

def hostgroup
  @hostgroup
end

- (Object) name (readonly)

Returns the value of attribute name



3
4
5
# File 'lib/nagira/hostgroup.rb', line 3

def name
  @name
end

- (Object) objects (readonly)

Returns the value of attribute objects



3
4
5
# File 'lib/nagira/hostgroup.rb', line 3

def objects
  @objects
end

- (Object) status(mode) (readonly)

Returns the value of attribute status



3
4
5
# File 'lib/nagira/hostgroup.rb', line 3

def status
  @status
end

Instance Method Details

- (Object) full

i.e. both servcie and hoststatus



18
19
20
21
22
23
# File 'lib/nagira/hostgroup.rb', line 18

def full
  members.each do |hostname|
    data[hostname] = @status[hostname]
  end
  data
end

- (Object) host_status



42
43
44
# File 'lib/nagira/hostgroup.rb', line 42

def host_status
  status 'hoststatus'
end

- (Object) members



13
14
15
# File 'lib/nagira/hostgroup.rb', line 13

def members
  hostgroup[:members].split(",")
end

- (Object) service_status



37
38
39
# File 'lib/nagira/hostgroup.rb', line 37

def service_status
  status 'servicestatus'
end