According to the site: God is an easy to configure, easy to extend monitoring framework written in Ruby.
While god is mainly intended for monitoring mongrels it is also a great way to keep an eye on apache itself. Below is our config for watching apache.
%w{80}.each do |port|
God.watch do |w|
w.name = "apache"
w.interval = 30.seconds # default
w.start = "apachectl start"
w.stop = "apachectl stop"
w.restart = "apachectl restart"
w.start_grace = 10.seconds
w.restart_grace = 10.seconds
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 5.seconds
c.running = false
end
end
end
end
The code is pretty self-explanatory. We’re just looking to make sure apache is up every 5 seconds.
After gem installing god, save the configuration file anywhere you want and kick if off with this command:
god -c /path/to/your_conf.god
That’s it. To test, kill apache and in less than 5 seconds it will be back up and running.
2 comments
that’s pretty cool.
You probably don’t need the port loop.
2 Trackbacks
[...] After installing God sudo gem install god –no-ri –no-rdoc, setup a conf.god somewhere sensible and take a look at the posts below, as it probably doesn’t make sense for me to reiterate what others have already admirably accomplished: Monitoring MySQL and setting up notifications. Monitoring Apache. [...]
[...] Monitoring apache with god | grits [...]