Will monit start my mongrel_cluster?

Hi,

I’m not sure if this would be better for the monit list – but this
seems specifically a monit+mongrel_cluster problem, so I’m hoping
someone here may have seen this before. I’m having problems getting
monit to start up my mongrel_cluster processes. When I start a mongrel
(using --only with mongrel_rails) from the cmdline, monit detects it
and monitors it just fine, I can see it at as ‘Status running’ at
http://localhost:2812. If I kill it, monit successfully restarts it.
However, if no mongrels are started and I just do
monit -g mongrel start all
==> /var/log/messages shows trying to restart and then failed to start.

The cmdline is exactly the same as the ‘start program’ value in monitrc.

Is this as expected? Do I need to start up my mongrels with explicit
mongrel_rails calls, and thereafter have monit restart them if they
fail? I’d hoped I could get to manage initial startup through monit as
well, keep config as DRY as possible with just a mongrel_cluster.yml and
a monitrc. Is this possible?

Or should I be getting the pack running initially with
/etc/init.d/mongrel_cluster and /etc/mongrel_cluster/* symlinks, and
then letting monit take over?

And then I can start on getting a script/spin that’ll work with cap
deploy:start …

Thanks for your attention - any feedback welcome.

– Thomas.

==== /etc/monitrc ====
set daemon 20
set logfile syslog facility log_daemon

FIXME! set alert [email protected]

set mailserver localhost
set mail-format { from: [email protected] }
set httpd port 2812 and use address localhost
allow localhost # Allow localhost to connect
allow admin:foo # Allow Basic Auth
include /etc/monit.d/*.monitrc

==== /etc/monit.d/mongrel_5000.monitrc – from Ezra Z.’
excellent version ez-monitrc ====

check process mongrel_harvest_5000
with pidfile /var/run/mongrel_cluster/mongrel_harvest.5000.pid
start program = “/usr/bin/mongrel_rails cluster::start --only 5000
–clean -C /var/www/rails/harvest/current/config/cluster_harvest.yml”
stop program = “/usr/bin/mongrel_rails cluster::stop --only 5000
–clean -C /var/www/rails/harvest/current/config/cluster_harvest.yml”
if totalmem is greater than 110.0 MB for 4 cycles then
restart # eating up memory?
if cpu is greater than 50% for 2 cycles then
alert # send an email to admin
if cpu is greater than 80% for 3 cycles then
restart # hung process?
if loadavg(5min) greater than 10 for 8 cycles then
restart # bad, bad, bad
if 20 restarts within 20 cycles then
timeout # something is wrong, call the sys-admin
if failed port 5000 protocol http # check for
response
with timeout 10 seconds
for 2 cycles
then restart
group mongrel

==== cluster_harvest.yml ====


user: mongrel
log_file: /var/log/mongrel/production_harvest.log
port: “5000”
environment: production
group: mongrel
address: 127.0.0.1
pid_file: /var/run/mongrel_cluster/mongrel_harvest.pid
servers: 3