Sha256: 0f9685b579febcaf4ec08de76dba5006d8e41edd54cfc2ca0adac6a614a7c739
Contents?: true
Size: 852 Bytes
Versions: 19
Compression:
Stored size: 852 Bytes
Contents
name 'http responder' always_start true default[:host], default[:port] = Kurchatov::Config[:http_responder].to_s.split(":") run_if do !!Kurchatov::Config[:http_responder] end helpers do @s_time = Time.now def json_info { :version => Kurchatov::VERSION, :uptime => (Time.now - @s_time).to_i, :monitor => monitor.inspect, :fqdn => Kurchatov::Config[:host], :app_name => 'kurchatov' }.to_json + "\n" end end run do @server ||= TCPServer.new(plugin.host, plugin.port) loop do client = @server.accept response = json_info client.gets headers = "HTTP/1.1 200 OK\r\n" + "Server: Kurchatov Ruby\r\n" + "Content-Length: #{response.bytesize}\r\n" + "Content-Type: application/json\r\n\r\n" client.print headers client.print response client.close end end
Version data entries
19 entries across 19 versions & 1 rubygems