class MysqlHealth::Server
Public Instance Methods
http_response(data)
click to toggle source
# File lib/mysql_health/server.rb, line 35 def http_response(data) MysqlHealth.log.debug("http_response") response = EventMachine::DelegatedHttpResponse.new(self) if data.nil? response.status = '500 Server Error' response.content = "Empty call to http_response\n" else data.each_pair do |k,v| MysqlHealth.log.debug("#{k}=#{v}") if k == :content_type response.send(k, v) else response.send("#{k}=".to_sym, v) end end end response end
post_init()
click to toggle source
Calls superclass method
# File lib/mysql_health/server.rb, line 30 def post_init super no_environment_strings end
process_http_request()
click to toggle source
# File lib/mysql_health/server.rb, line 54 def process_http_request response = nil begin case @http_path_info when '/master_status' response = http_response(MysqlHealth.health.master_status) when '/slave_status' response = http_response(MysqlHealth.health.slave_status) else response = http_response({:status => '501 Not Implemented'}) end rescue Exception => e response = http_response({:status => '500 Server Error', :content => e.message + "\n" + e.backtrace.join("\n")}) end response.send_response end