In one of my ruby applications, there was a requirement to monitor application log file. We did it very quickly with sinatra web application framework. The requests made are checking whether application is running, viewing log file, etc.
http://www.sinatrarb.com/intro.html
Sinatra is a DSL for quickly creating web-applications in Ruby with minimal effort. In Sinatra, a route is an HTTP method paired with an URL matching pattern. Each route is associated with a block. Routes are matched in the order they are defined. The first route that matches the request is invoked.
Sinatra rides on Rack, a minimal standard interface for Ruby web frameworks. One of Rack’s most interesting capabilities for application developers is support for “middleware” — components that sit between the server and your application monitoring and/or manipulating the HTTP request/response to provide various types of common functionality.
Just do this and you will be on track :-)
gem install sinatra
ruby myapp.rb
In myapp.rb :-
get '/checklog' do
Some code here ...
[200, {"Content-Type" => "text/html"},
"Log is ok?:true or false]
end
Thursday, April 23, 2009
Subscribe to:
Posts (Atom)