# God 0.4.0 released

**URL:** <https://www.ruby-forum.com/t/god-0-4-0-released/114301>\
**Category:** Ruby\
**Created:** [September 11, 2007, 1:33am UTC](https://www.ruby-forum.com/t/god-0-4-0-released/114301 "2007-09-11T01:33:00Z")\
**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:** [September 11, 2007, 1:33am UTC](https://www.ruby-forum.com/t/god-0-4-0-released/114301/1 "2007-09-11T01:33:00Z")

</div>

Progress on god is moving along as quick as ever. This release adds a  
bunch of new features and bug fixes. Most interestingly you’ll find  
several useful new command line functions:

- `god status` prints out the status of each Watch
- `god log` shows realtime logs for a specific Watch (even if you  
don’t have god logging to file)
- `god load` loads or reloads a config file into a running god  
instance
- `god terminate` stops all Watches and then stops god (useful when  
testing your setup)

The logging system has been beefed up with proper timestamps and  
criticality levels. Log messages are more complete overall. You can also  
get the STDOUT/STDERR of a god-daemonized process written to a log file  
by specify ‘w.log = ’ in your Watch config.

If you let god daemonize your process for you, there’s no need to  
provide a stop command. A default killing lambda will take care of  
gracefully (or not so gracefully if necessary) stopping your  
god-daemonized process.

The validity of your config file is checked better than previous  
versions to point you to the problem area of your config.

The bug that prevented group control from working has been fixed so you  
can now start/stop/etc groups of Watches.

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 very young, I’d love to get feedback and bug reports, but I  
do not yet recommend you use it for mission critical tasks. I personally  
use it in production but then I’m a daring fellow.

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:

# file: gravatar.god

# 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 = “/var/www/gravatar2/current”

%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 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  
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

```

end  
end

DOCS

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

CHANGES

== 0.4.0 / 2007-09-10

- Major Enhancements
  - Add the ability for conditions to override transition state (for  
exceptional cases)
  - Implement dynamic load of config files while god is running (god  
load )
  - Add ability to save auto-daemonized process output to a log file
  - Add robust default stop lambda command for auto-daemonized processes  
(inspired by \_eric)
  - Add status command for god binary (shows status of each watch)
  - Create proper logger with timestamps
  - Add log command to god binary to get real time logs for a specific  
watch from a running god instance
  - Add terminate command for god binary (stop god and all watches)

- Minor Enhancements
  - Enforce validity of Watches
  - Enforce that God.init is not called after a Watch
  - Move pid\_file\_directory creation and validation to God.start
  - Remove check for at least one Watch during startup (now that dynamic  
loading exists)

- New Conditions
  - Tries \< PollCondition - triggers after the specified number of tries
  - Add :notify\_when\_flapping behavior to check for oscillation  
[kevinclark]
  - Add :degrading\_lambda condition. [kevinclark]  
It uses a decaying interval (1/2 rate) for 3 cycles before failing.

- Bug Fixes
  - Use exit!(0) instead of exit! in god binary to exit with code 0  
(instead of default -1)
  - Command line group control fixed
  - Fix cross-thread return problem

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)
