Class: DNApi::Components::Nagios

Inherits:
Struct
  • Object
show all
Includes:
DNApi::Component
Defined in:
lib/dnapi/components/nagios.rb

Instance Attribute Summary collapse

Attributes inherited from Struct

#parent

Instance Method Summary collapse

Methods included from DNApi::Component

[], #can_belong_to?, components, from, included, #key, #to_hash

Methods inherited from Struct

#==, _many, #_many, #_many_values, _ones, #_ones, #_ones_values, _umembers, belongs_to, from, #initialize, #inspect, many, map, one, #to_hash, #umember_inspect, unserialized_member

Methods included from Test::Ext

#default_fauxture_name, #fixture, #generate, #generate_attributes, #pick

Constructor Details

This class inherits a constructor from DNApi::Struct

Instance Attribute Details

#endpointObject

Returns the value of attribute endpoint

Returns:

  • (Object)

    the current value of endpoint



3
4
5
# File 'lib/dnapi/components/nagios.rb', line 3

def endpoint
  @endpoint
end

#master_keyObject

Returns the value of attribute master_key

Returns:

  • (Object)

    the current value of master_key



3
4
5
# File 'lib/dnapi/components/nagios.rb', line 3

def master_key
  @master_key
end

Instance Method Details

#master?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/dnapi/components/nagios.rb', line 15

def master?
  master_instance == instance
end

#master_instanceObject



11
12
13
# File 'lib/dnapi/components/nagios.rb', line 11

def master_instance
  instance.environment.instances.detect {|i| i.id == master_key }
end

#monitored_instancesObject



19
20
21
22
23
24
25
# File 'lib/dnapi/components/nagios.rb', line 19

def monitored_instances
  if master?
    instance.environment.instances
  else
    [master_instance]
  end
end