Monit fails to start|stop mongrel_rails

I’m battling with Monit on Debian Etch and need some help. I’ve
included the mongrel.monitrc file I’m using. If you issue the start
program and stop program commands shown in that file from the command
line, they work fine, regardless of what directory you issue them
from. Interestingly, calling “monit status” does show that the
test3_8001 process is being monitored and shows the correct statistics
for uptime, etc. However, when you run “monit restart test3_8001”
there is a failure. “monit status” eventually shows “Execution
failed” as a status for test3_8001, but does continue to show all the
other correct stats as before. Checking the monit_errors.log shows
only the following:
488 [PDT Jun 6 20:56:22] info : ‘mongrel_test3_8001’ trying to
restart
489 [PDT Jun 6 20:56:22] info : ‘mongrel_test3_8001’ start: /usr/
bin/env
490 [PDT Jun 6 20:56:23] error : ‘mongrel_test3_8001’ failed to
stop

Other notes:

  • Paths
    —> I tried just having the /usr/local/lib/site_ruby/gems/bin/
    mongrel_rails cluster::start -C /home/jay/test/testing/config/
    mongrel_cluster.yml --clean --only 8001" as a path
    —> I also tried adding the path to the ruby executable which is /usr/
    local/bin/ruby on my machine prior to the above.

the mongrel.monitrc file:

check process test3_8001
with pidfile /home/jay/test/testing/tmp/pids/mongrel.8001.pid
start program = “/usr/bin/env PATH=$PATH:/usr/local/lib/site_ruby/
gems/bin /usr/local/lib/site_ruby/gems/bin/mongrel_rails
cluster::start -C /home/jay/test/testing/config/mongrel_cluster.yml –
clean --only 8001”
stop program = “//usr/bin/env PATH=$PATH:/usr/local/lib/site_ruby/
gems/bin /usr/local/lib/site_ruby/gems/bin/mongrel_rails cluster::stop
-C /home/jay/test/testing/config/mongrel_cluster.yml --only 8001”

if cpu > 60% for 2 cycles then alert

if cpu > 80% for 4 cycles then restart
if totalmem > 110.0 MB for 4 cycles then restart

if children > 250 then restart

if loadavg(5min) greater than 10 for 8 cycles then stop

if failed host www.tildeslash.com port 80 protocol http

and request “/monit/doc/next.php”

then restart

if failed port 443 type tcpssl protocol http

with timeout 15 seconds

then restart

if 20 restarts within 20 cycles then timeout

depends on apache_bin

group test_mongrels

Thanks for any thoughts - I’m at a loss…

JBB

The answer for me at long last was to set GEM_HOME in the
mongrel.monitrc file. So
start program = "env GEM_HOME= /usr/local/bin/
mongrel_rails cluster::start -C …