Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

god: Extensible Process Monitoring Framework

By Hendy Irawan / July 18, 2007

god monitors your server processes and tasks to make sure they run smoothly, and performs maintenance tasks (such as restarting your application servers) as necessary. This Ruby application is written by Tom Preston-Werner and serves similar functionality to, and inspired by, a popular tool called monit.

Among the features god provides include:

  • Config file is written in Ruby
    Easily write your own custom conditions in Ruby
    Supports both poll and event based conditions
    Different poll conditions can have different intervals

Here's a part of an example config file used to monitor mongrel instances:

god.watch do |w|
  w.name = "gravatar2-mongrel-#{port}"
  w.interval = 30 # seconds
  w.start = "mongrel_rails cluster::start --only #{port}
    -C #{RAILS_ROOT}/config/mongrel_cluster.yml"
  w.stop = "mongrel_rails cluster::stop --only #{port}
    -C #{RAILS_ROOT}/config/mongrel_cluster.yml"
  w.grace = 10 # seconds

  ...
end

Monit users (including myself) will instantly recognize the mapping between monit rules/tests and the ones in a god config file. The main difference and advantage is, because god uses the Ruby language, you can have all sorts of advanced tests, loops, and even include your own extensions like modules and mixins. God actually supports an official mechanism for this purpose.

Install god using Rubygems:

sudo gem install god -y

The god web page has thorough information and you can also browse the source code directly.

About Hendy Irawan

Ruby programmer from Indonesia. View all posts by Hendy Irawan →

Comments

  1. Nick says:

    I don't believe in god

  2. Tamer Salama says:

    Haven't they found a better name ?!

  3. Peter Cooper says:

    I don't understand all the hoopla around the name. A lot of supposedly intelligent people wasted a lot of their valuable time actually discussing this in ruby-talk and sent the S/N ratio through the floor. It's a name, much like Mongrel, Hpricot, or that any other Ruby library has.

  4. Hendy Irawan says:

    Dear Nick and Tamer,

    It seems a lot of people agree with you, as you're not the only one who says so. :-)

    You might be interested at debates around the god monitoring framework. There's no bad time for a bit of entertainment. ;-)

  5. Kevin Clark says:

    god 0.2.0 is actually already out if you want to take a look. The new release features event based monitoring (straight from kqueue or netlink depending on your OS), so things can come back up as soon as they go down.

  6. Hendy Irawan says:

    Thanks Kevin for the update! :-)

  7. g says:

    More pointless wheel re-inventing by someone who drank too much Ruby kool-aid.

Other Posts to Enjoy

Twitter Mentions