Class: DTR::Monitor::MasterMonitor
Instance Method Summary
collapse
#all_agents_info, #new_agent_monitor, #provide_agent_info
#lookup, #lookup_ring, #start_service, #stop_service
#relax, #sleep?, #wakeup?
Instance Method Details
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/dtr/monitor.rb', line 62
def monitor
msg, from_host, group = listen
unless ["127.0.0.1:#{DTR.configuration.rinda_server_port}"].include?(from_host)
puts "Master process message from #{from_host}: #{msg} for group #{group}"
ip, port = from_host.split(':')
with_configuration(ip, port) do
start_service
puts "Agents working for #{from_host}: "
puts all_agents_info.collect{|i| " #{i.strip}"}.join("\n")
end
end
end
|
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/dtr/monitor.rb', line 46
def start
Process.fork do
begin
loop do
monitor
end
rescue Errno::EADDRINUSE
puts "There is DTR agent started on this machine."
puts "Shutdown it for monitoring working DTR Master info."
rescue Interrupt
ensure
relax
end
end
end
|
#with_configuration(ip, port) ⇒ Object