Class: Cloudscale::Monitor::Registry

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/cloudscale/registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



18
19
20
21
# File 'lib/cloudscale/registry.rb', line 18

def initialize
  @metrics = Hash.new
  @stored_agent = Constants::Agent.load
end

Instance Attribute Details

#metricsObject

Returns the value of attribute metrics.



16
17
18
# File 'lib/cloudscale/registry.rb', line 16

def metrics
  @metrics
end

#stored_agentObject

Returns the value of attribute stored_agent.



16
17
18
# File 'lib/cloudscale/registry.rb', line 16

def stored_agent
  @stored_agent
end

Instance Method Details

#agent_instance_idObject



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cloudscale/registry.rb', line 23

def agent_instance_id
  agent_config = Constants::AgentInstance.load
  if agent_config != nil then
    instance_id = agent_config["agentInstanceId"]
  end
  if (instance_id == nil)
    return SecureRandom.hex
  else
    return instance_id
  end
end

#stored_agent_instanceObject



35
36
37
# File 'lib/cloudscale/registry.rb', line 35

def stored_agent_instance
  Constants::AgentInstance.load
end