Rails plugin to change the process name under FCGI to display recent activity. A port of Howl.
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
tasks
test
MIT-LICENSE
README
Rakefile
init.rb
install.rb
uninstall.rb

README

FcgiStatus
==========

An FCGI version of the Howl plugin (http://github.com/nkallen/howl/tree/master)


Example
=======

class ApplicationController < ActionController::Base
  include FcgiStatus

  … your other code.
end

In top or ps your process will look like:

dispatch.fcgi (1/13m37.00s): last job: YourController#show GET (/bob.xml)

If you would like a custom key in the process list rather than path you can define a method named fcgi_key. Be aware that this method will be called BEFORE the controller action so any fields used must be initialized in previous filter or within the fcgi_key method itself.

class YourController < ApplicationController
  def fcgi_key
    "a=#{@key1} ; b=#{@key2}"
  end
end

Which will produce a process name like:

dispatch.fcgi (1808/13m37.00s): last job: YourController#show GET (a=foo ; b=bar)

You can also change FcgiStatus to display information in place of the process uptime:

FcgiStatus.mode = :cpu           # Show the processes user and system cpu
FcgiStatus.mode = :cpu_extended  # :cpu plus child process user and system cpu
FcgiStatus.mode = :time          # the default display

WARNING: On many operating systems the process name cannot be changed to a value longer than the original command line. In order to work around this you can add change the #! line of your dispatch.fcgi like so:

#!/usr/bin/ruby -I/non-existent-padding-directory-name  -I/non-existent-padding-directory-name -I/non-existent-padding-directory-name -I/non-existent-padding-directory-name 

Copyright (c) 2008 Twitter, Inc. released under the MIT license