god Server process monitoring and notifying tool written in ruby
Posted by Bhushan Ahire | Posted in Rails, ruby | Posted on 18-03-2008
0
Progress on god is moving along as quick as ever. Most interestingly you’ll find several useful new command line functions:
god statusprints out the status of each Watchgod logshows realtime logs for a specific Watch (even if you don’t have god logging to file)god loadloads or reloads a config file into a running god instancegod terminatestops 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 =
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:
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.
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 to keep the mongrels running:
# file: application_name.god # run with: god -c /path/to/application_name.god # # This is the actual config file used to keep the mongrels of # application.com running. RAILS_ROOT = "/var/www/application_name/current" %w{8001 8002 8003}.each do |port| God.watch do |w| w.name = "application_name-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 |
Configuration for nginx and mysql
I found a gr8 post for sample configuration here
DOCS
Detailed documentation is available at http://god.rubyforge.org/
