lib/scout_realtime/main.rb in scout_realtime-1.0.3 vs lib/scout_realtime/main.rb in scout_realtime-1.0.4
- old
+ new
@@ -5,13 +5,14 @@
TTL=60 # time in seconds for collectors to cache slow system commands
LOG_NAME="realtime.log"
attr_accessor :running, :runner, :stats_thread
- # opts: {:port=>xxx}
+ # opts: {:port=>xxx, bind=>'0.0.0.0'}
def initialize(opts={})
@port=opts[:port]
+ @bind_address=opts[:bind] || '0.0.0.0'
Scout::Realtime::logger=Logger.new(STDOUT)
@stats_thread = Thread.new {}
@runner = Scout::Realtime::Runner.new
end
@@ -48,15 +49,15 @@
# #Scout::Realtime::WebApp.quit! #
# end
#end
start_thread
- Scout::Realtime::WebApp.run!(:port=>@port)
+ Scout::Realtime::WebApp.run!(:port=>@port,:bind=>@bind_address)
end
def go_webrick
logger.info("starting web server ")
- server = WEBrick::HTTPServer.new(:Port => 5555, :AccessLog => [])
+ server = WEBrick::HTTPServer.new(:Port => @port, :AccessLog => [], :BindAddress => @bind_address)
server.mount '/', Scout::Realtime::WebServer
trap 'INT' do
server.shutdown
end
#start_thread