Anyone that reads blogs from the Rails community has probably already heard about God. No, not the deity in the sky, but an excellent monitoring application that watches your processes and keeps them running. I’ve mostly seen it used for taming mongrel but it can be used to monitor any process.

We’re running God for all our managed hosting clients to make sure their mongrels don’t pass out from exhaustion. It’s held up great so far. See the resources at the end of this article for our init script and a sample global config.

The God configuration file should be self explanatory. It’s just Ruby code, nothing magic going on there. I’ve just wrapped the core code around some loops to enable support for monitoring an unlimited number of applications. One small note about the init.d script: it first launches God, and then loads the config file via the ‘god load’ command. I’m aware that you can send god the -c parameter when launching it, but I’ve found that sometimes (seemingly randomly) that won’t load the config.

The init.d script should work fine on any RHEL/CentOS system. Once you add the file to /etc/init.d/god just do:

chmod +x /etc/init.d/god

chkconfig --add god

chkconfig --level 345 god on

/etc/init.d/god start

Now you’re good to go. Let those misbehaving K-9 devils do their best – they’re no match for God.

Here are a couple resources relevant to this article:

Leave a Reply