# God 0.5.0 released

**URL:** <https://www.ruby-forum.com/t/god-0-5-0-released/116691>\
**Category:** Ruby\
**Created:** [October 8, 2007, 7:32pm UTC](https://www.ruby-forum.com/t/god-0-5-0-released/116691 "2007-10-08T19:32:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomfarm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b5ac83/32.png) [@tomfarm](https://www.ruby-forum.com/u/tomfarm)\
**Post date:** [October 8, 2007, 7:32pm UTC](https://www.ruby-forum.com/t/god-0-5-0-released/116691/1 "2007-10-08T19:32:06Z")

</div>

This release brings about a tremendous leap in stability and robustness.  
A large number of bugs have been discovered and addressed while god is  
being run in a production environment. We’re battle testing god so you  
don’t have to!

There’s a number of new features that you’ll want to know about:

- You can now define lifecycle conditions that are active during the  
full lifetime of a monitored process. This is especially useful for the  
:flapping condition that can detect when a process is being started over  
and over.

- A notification framework has been added that allows you to be notified  
when conditions trigger. Currently there is an :email contact type that  
can send over SMTP (with optional authentication). Creating your own  
custom contact types is also extremely simple.

- Watches are now a specialized subclass of Tasks. Tasks don’t know  
anything about processes and allow you to specify arbitrary states and  
setup a state machine for dealing with non-process monitoring.

- Log output is much more human readable. It’s very easy to tell exactly  
what’s going on with your process and what conditions are triggering.

- The CLI tools now use a UNIX domain socket to communicate with god.  
This means better security by enforcing that only authorized users can  
interact with god.

- An :http\_response\_code condition is now included that allows you to  
poll a website and ensure that a response code is within bounds.

Updated documentation is now available on the website:

[http://god.rubyforge.org/](http://god.rubyforge.org/)

WHAT IS GOD?

God is an easy to configure, easy to extend monitoring framework written  
in Ruby.

Keeping your server processes and tasks running should be a simple part  
of your deployment process. God aims to be the simplest, most powerful  
monitoring application available.

DISCLAIMER

God is still beta so I do not yet recommend you use it for mission  
critical tasks. We are using it at Powerset, Inc. to monitor our public  
facing applications, but then, we’re daring fellows.

INSTALL

sudo gem install god

FEATURES

- 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
- Easily control non-daemonized processes

EXAMPLE

The easiest way to understand how god will make your life better is by  
looking at a sample config file. The following configuration file is  
what I use at [gravatar.com](http://gravatar.com) to keep the mongrels running:

# run with: god -c /path/to/gravatar.god

# 

# This is the actual config file used to keep the mongrels of

# [gravatar.com](http://gravatar.com) running.

RAILS\_ROOT = “/Users/tom/dev/gravatar2”

%w{8200 8201 8202}.each do |port|  
God.watch do |w|  
w.name = “gravatar2-mongrel-#{port}”  
w.interval = 30.seconds # default  
w.start = “mongrel\_rails start -c #{RAILS\_ROOT} -p #{port}   
-P #{RAILS\_ROOT}/log/mongrel.#{port}.pid -d”  
w.stop = “mongrel\_rails stop -P  
#{RAILS\_ROOT}/log/mongrel.#{port}.pid”  
w.restart = “mongrel\_rails restart -P  
#{RAILS\_ROOT}/log/mongrel.#{port}.pid”  
w.start\_grace = 10.seconds  
w.restart\_grace = 10.seconds  
w.pid\_file = File.join(RAILS\_ROOT, “log/mongrel.#{port}.pid”)

```
w.behavior(:clean_pid_file)

w.start_if do |start|
  start.condition(:process_running) do |c|
    c.interval = 5.seconds
    c.running = false
  end
end

w.restart_if do |restart|
  restart.condition(:memory_usage) do |c|
    c.above = 150.megabytes
    c.times = [3, 5] # 3 out of 5 intervals
  end

  restart.condition(:cpu_usage) do |c|
    c.above = 50.percent
    c.times = 5
  end
end

# lifecycle
w.lifecycle do |on|
  on.condition(:flapping) do |c|
    c.to_state = [:start, :restart]
    c.times = 5
    c.within = 5.minute
    c.transition = :unmonitored
    c.retry_in = 10.minutes
    c.retry_times = 5
    c.retry_within = 2.hours
  end
end

```

end  
end

DOCS

Detailed documentation is available at [http://god.rubyforge.org/](http://god.rubyforge.org/)

CHANGES

== 0.5.0 / 2007-10-05

- Major Enhancements
  - Implement lifecycle scoped metric to allow for cross-state  
conditions
  - Add TriggerCondition for conditions that need info about state  
changes
  - Implement notification system
  - Add Tasks (a generalization of Watches) to do non-process related  
tasks
  - Add example init.d file in GOD\_INSTALL\_DIR/init/god [scott becker]
  - Add human readable info to conditions (and make low level log lines  
debug)
  - Switch DRb to use a unix domain socket for security reasons

- Minor Enchancements
  - Allow EventConditions to do transition overloading
  - Report errors during god startup instead of failing silently
  - Make transition block optional (default to Always condition  
returning true)
  - Better usage info for `god --help`
  - Explain what’s going on when attempting to rebind to an in-use port
  - Add -b option to god binary to auto-bind to an unused port
  - Add `god quit` to stop god without stopping any tasks
  - Make self-daemonized Watch commands synchronous (as they should be)
  - Allow self-daemonized Watches to specify a log (could be useful)
  - Check for existence of config file if specified
  - Robustify `god load` and report errors back to the command issuer
  - Warn when `god load` tries to set global options
  - Add Configurable.clear method and make built-in conditions clear on  
entry

- New Conditions
  - Flapping \< TriggerCondition - trigger on state change
  - HttpResponseCode \< PollCondition - trigger on http response code or  
timeout (thx scott becker)

- New Contacts
  - Email \< Contact - notify via email (smtp)

- Bug Fixes
  - Fix abort not aborting problem
  - Fix -p option not working for god binary
  - Fix God.init not accepting block (thx \_eric)
  - Fix SIGHUP ignore (thx \_eric)
  - Fix error reporting on `god --help` (don’t error report a normal  
SystemExit)

AUTHORS

Tom Preston-Werner  
Kevin C.

–  
Tom Preston-Werner

- Libraries:  
Chronic ([chronic.rubyforge.org](http://chronic.rubyforge.org))  
God ([god.rubyforge.org](http://god.rubyforge.org))  
Fuzed ([fuzed.rubyforge.org](http://fuzed.rubyforge.org))
- Site:  
[rubyisawesome.com](http://rubyisawesome.com)
