class Bosh::Monitor::Agent
Constants
- ATTRIBUTES
Attributes
discovered_at[R]
id[R]
updated_at[RW]
Public Class Methods
new(id, opts={})
click to toggle source
# File lib/bosh/monitor/agent.rb, line 14 def initialize(id, opts={}) raise ArgumentError, "Agent must have an id" if id.nil? @id = id @discovered_at = Time.now @updated_at = Time.now @logger = Bhm.logger @intervals = Bhm.intervals @deployment = opts[:deployment] @job = opts[:job] @index = opts[:index] @cid = opts[:cid] @instance_id = opts[:instance_id] end
Public Instance Methods
name()
click to toggle source
# File lib/bosh/monitor/agent.rb, line 30 def name if @deployment && @job && @instance_id name = "#{@deployment}: #{@job}(#{@instance_id}) [id=#{@id}, " if @index name = name + "index=#{@index}, " end name + "cid=#{@cid}]" else state = ATTRIBUTES.inject([]) do |acc, attribute| value = send(attribute) acc << "#{attribute}=#{value}" if value acc end "agent #{@id} [#{state.join(", ")}]" end end
rogue?()
click to toggle source
# File lib/bosh/monitor/agent.rb, line 54 def rogue? (Time.now - @discovered_at) > @intervals.rogue_agent_alert && @deployment.nil? end
timed_out?()
click to toggle source
# File lib/bosh/monitor/agent.rb, line 50 def timed_out? (Time.now - @updated_at) > @intervals.agent_timeout end