[Mongrel] Machine reboot - monit fails to start mongrels

Carl Lerche carl.lerche at gmail.com
Thu Mar 29 22:26:24 EDT 2007


I just would like to say that I did this on FreeBSD 6.2 and it fails.
The problem is that there seems to be a slight bug in mongrel_cluster
which prevents it to find the pid files (and clean them if necessary).
If you still have trouble, it might be this. Let me know.

I posted about this in another thread.

-carl

On 3/29/07, Joey Geiger <jgeiger at gmail.com> wrote:
> You can use the new mongrel_cluster gem to startup your mongrels one
> at a time, and it will also clear any stale pid files.
>
> Here's an example of part of my monitrc that uses the cluster start.
>
> ###
> # monitor mongrel four
> ###
> check process mongrel-8003
>   with pidfile /var/run/mongrel_cluster/mongrel.8003.pid
>   group mongrel
>   alert monit at website.com only on { connection, resource }
>
>   start program = "/usr/bin/ruby /usr/bin/mongrel_rails cluster::start --only 80
> 03 --clean  -C /etc/mongrel_cluster/website_mongrel_cluster.yml"
>
>   stop program = "/usr/bin/ruby /usr/bin/mongrel_rails cluster::stop --only 8003
>  -C /etc/mongrel_cluster/website_mongrel_cluster.yml"
>
>   if totalmem > 50.0 MB for 5 cycles then restart
>   if cpu is greater than 60% for 2 cycles then alert
>   if cpu > 80% for 5 cycles then restart
>
>   if failed url
>     http://localhost:8003/monit/index
>     and content == 'success'
>     with timeout 15 seconds then restart
>
>
>
>
> On 3/29/07, Henry <hpoydar at gmail.com> wrote:
> > Greetings -
> >
> > I dug around a bit and I couldn't find a definitive answer to this
> > question, apologies if it's been covered before.   A box running a
> > apache 2.2 -> mongrel cluster for a rails app got power cycled at my
> > ISP.  Unfortunately monit couldn't start the mongrel processes
> > because the pid files were still there. Here is my monit config (for
> > each mongrel process):
> >
> > check process myapp_mongrel_8000 with pidfile /data/wwwroot/myapp.com/
> > log/mongrel.8000.pid
> >          start program = "/usr/bin/mongrel_rails start -d -e
> > production -p 8000 -a 127.0.0.1 -P log/mongrel.8000.pid -c /data/
> > wwwroot/myapp.com --user mongrel --group mongrel"
> >          stop program = "/usr/bin/mongrel_rails stop -P log/mongrel.
> > 8000.pid -c /data/wwwroot/myapp.com"
> >          if failed host 127.0.0.1 port 8000 protocol http
> >                  and request "/" then alert
> >          if cpu is greater than 60% for 2 cycles then alert
> >          if cpu > 80% for 5 cycles then restart
> >          if loadavg(5min) greater than 10 for 8 cycles then restart
> >          if 3 restarts within 5 cycles then timeout
> >
> > Is there some other command line switch I can add to avoid this
> > problem?  Should I config monit to clear the .pid files first?
> >
> > Thanks,
> > Henry
> >
> >
> >
> > _______________________________________________
> > Mongrel-users mailing list
> > Mongrel-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/mongrel-users
> >
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users
>


-- 
EPA Rating: 3000 Lines of Code / Gallon (of coffee)


More information about the Mongrel-users mailing list