Class: LogStash::Kibana::Runner
- Inherits:
-
Object
- Object
- LogStash::Kibana::Runner
- Defined in:
- lib/logstash/kibana.rb
Overview
class App
Defined Under Namespace
Classes: Settings
Instance Method Summary collapse
Instance Method Details
#run(args) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/logstash/kibana.rb', line 58 def run(args) settings = Settings.new settings.address = "0.0.0.0" settings.port = 9292 settings.backend = "localhost" progname = File.basename($0) opts = OptionParser.new do |opts| opts. = "Usage: #{progname} [options]" opts.on("-a", "--address ADDRESS", "Address on which to start webserver. Default is 0.0.0.0.") do |address| settings.address = address end opts.on("-p", "--port PORT", "Port on which to start webserver. Default is 9292.") do |port| settings.port = port.to_i end #opts.on("-b", "--backend host", #"The backend host to use. Default is 'localhost'") do |host| #settings.backend = host #end end begin args = opts.parse(args) rescue SystemExit # if you ask for --help, optparse will exit. # capture it and return normally return [] end @thread = Thread.new do Cabin::Channel.get.info("Starting web server", :settings => settings) ftw = Rack::Handler::FTW.new(LogStash::Kibana::App.new, :Host => settings.address, :Port => settings.port) trap_id = Stud::trap("INT") do puts "Stopping web..." ftw.stop rescue nil raise SystemExit end ftw.run end return args end |
#wait ⇒ Object
108 109 110 111 |
# File 'lib/logstash/kibana.rb', line 108 def wait @thread.join if @thread return 0 end |