http://jay.gooby.org/tag/monit Posts tagged with "monit" - Jay Caines-Gooby 2010-09-21T11:14:14+01:00 Jay Caines-Gooby jay@gooby.org http://jay.gooby.org/ http://jay.gooby.org/post/monit-managing-mongrels Monit managing mongrels 2010-09-21T11:14:14+01:00 2010-09-21T11:15:02+01:00 <p><a href="http://monit.com"><img src="/media/monit.png"/></a></p> <p>Like <a href="http://www.google.co.uk/search?client=safari&amp;rls=en&amp;q=monit+mongrel_rails+execution+failed">everybody else</a>, I was getting the dreaded &#8220;Execution failed&#8221; from monit when it couldn&#8217;t restart a mongrel which had gone out-of-bounds on its monitoring settings.</p> <p>The solution that worked for me was the env and $<span class="caps">PATH</span> line:</p> <pre name="code" class="bash:nogutter:nocontrols"> start program = "/usr/bin/env PATH=/bin:/usr/local/bin:$PATH \ ruby mongrel_rails cluster::start \ -C /etc/mongrel_cluster/myapp.yml \ --clean --only 8000" stop program = "/usr/bin/env PATH=/bin:/usr/local/bin:$PATH \ ruby mongrel_rails cluster::stop \ -C /etc/mongrel_cluster/myapp.yml \ --only 8000" </pre> <p>But what scuppered me and will hopefully help you, is that whilst trying the various options suggested by Google, <em>I wasn&#8217;t reloading the monit config</em>. Doh!</p> <p>So if you&#8217;re trying to debug your failing mongrels under monit here are a couple of tips&#8230;</p> <p>Start a new shell, and unset your <span class="caps">PATH</span> to mimic how monit behaves:</p> <pre name="code" class="bash:nogutter:nocontrols"> sh unset PATH </pre> <p>Now you can test your monit stop/start lines (you&#8217;ll need to sudo as monit normally runs as root)&#8230;</p> <pre name="code" class="bash:nogutter:nocontrols"> /usr/bin/sudo /usr/bin/env PATH=/bin:/usr/local/bin:$PATH \ mongrel_rails cluster::stop \ -C /etc/mongrel_cluster/myapp.yml \ --only 8000 /usr/bin/sudo /usr/bin/env PATH=/bin:/usr/local/bin:$PATH \ mongrel_rails cluster::start \ -C /etc/mongrel_cluster/myapp.yml \ --clean \ --only 8000 </pre> <p>If that works for you, then you can be pretty sure that it&#8217;ll work for monit, as long as you <strong>remember to reload your monit config after making the changes</strong>.</p>