[Mongrel] Monit + Mongrel woes

Corey Donohoe atmos at atmos.org
Tue Mar 27 12:16:41 EDT 2007


Upload your mongrel_cluster.yml here
http://monitr.atmos.org/generators/mongrel_cluster

sudo gem install mongrel_cluster --source
http://mongrel.rubyforge.org/releases/ && gem cleanup

That should get you going in the right direction.

On 3/26/07, Carl Lerche <carl.lerche at gmail.com> wrote:
>
> Hello,
>
> How would I tell mongrel_cluster to restart a single mongrel instance
> (if only one of them failed? Do you have an example of a monitrc file
> that uses mongrel_cluster?
>
> Thanks,
> -carl
>
> On 3/26/07, Joey Geiger <jgeiger at gmail.com> wrote:
> > If you're not using mongrel_cluster, you might want to look into using
> it.
> >
> > If you are, I would suggest rewriting your monit scripts to deal with
> > the new pid file location, and such.
> >
> > The new mongrel_cluster can handle the leftover pid files, and will
> > clean them up before attempting to restart.
> >
> > On 3/26/07, Carl Lerche <carl.lerche at gmail.com> wrote:
> > > Hello all,
> > >
> > > So, I've been using monit with mongrel for a while now, since the
> > > 0.3.x days (I think it was). It used to work fine, but now I seem to
> > > be having some trouble. I'm currently using mongrel 1.0.1 and I am
> > > using the same monit configuration I've always been using, yet
> > > everytime monit should restart mongrel, I get "Execution failed".
> > >
> > > For the start command, I originally used the following:
> > > ------------
> > > start program = "/usr/bin/su admin -c '/usr/local/bin/mongrel_rails
> > > start -d -e production -p 8001 -a 127.0.0.1 -c
> > > /home/admin/webapps/gohuman/current -P log/mongrel.8001.pid'"
> > > ------------
> > > But then monit started giving me execution failed errors and when I
> > > tried to run it manually I got a "PID already exists" error. So, I
> > > tried the following:
> > > ------------
> > > start program = "/bin/rm -f
> > > /home/admin/webapps/gohuman/shared/log/mongrel.8001.pid && /usr/bin/su
> > > admin -c '/usr/local/bin/mongrel_rails start -d -e production -p 8001
> > > -a 127.0.0.1 -c /home/admin/webapps/gohuman/current -P
> > > log/mongrel.8001.pid'"
> > > ------------
> > > Which just adds the rm at the start. Yet, monit still can't manage to
> > > restart mongrel. I have no idea why. This is my full monit file
> > >
> > > ------------
> > > ##### mongrel 8000 - GoHuman #####
> > > check process mongrel-8000 with pidfile
> > > /home/admin/webapps/gohuman/shared/log/mongrel.8000.pid
> > >     start program = "/bin/rm -f
> > > /home/admin/webapps/gohuman/shared/log/mongrel.8000.pid && /usr/bin/su
> > > admin -c '/usr/local/bin/mongrel_rails start -d -e production -p 8000
> > > -a 127.0.0.1 -c /home/admin/webapps/gohuman/current -P
> > > log/mongrel.8000.pid'"
> > >     stop program  = "/usr/bin/su admin -c
> > > '/usr/local/bin/mongrel_rails stop -c
> > > /home/admin/webapps/gohuman/current -P log/mongrel.8000.pid'"
> > >
> > >     if totalmem is greater than 80.0 MB for 5 cycles then alert
> > >  # 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 3 restarts within 5 cycles then timeout
> > >  # something is wrong, call the sys-admin
> > >
> > >     group gohuman
> > >
> > > ##### mongrel 8001 - GoHuman #####
> > > check process mongrel-8001 with pidfile
> > > /home/admin/webapps/gohuman/shared/log/mongrel.8001.pid
> > >     start program = "/bin/rm -f
> > > /home/admin/webapps/gohuman/shared/log/mongrel.8001.pid && /usr/bin/su
> > > admin -c '/usr/local/bin/mongrel_rails start -d -e production -p 8001
> > > -a 127.0.0.1 -c /home/admin/webapps/gohuman/current -P
> > > log/mongrel.8001.pid'"
> > >     stop program  = "/usr/bin/su admin -c
> > > '/usr/local/bin/mongrel_rails stop -c
> > > /home/admin/webapps/gohuman/current -P log/mongrel.8001.pid'"
> > >
> > >     if totalmem is greater than 80.0 MB for 5 cycles then alert
> > >  # 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 3 restarts within 5 cycles then timeout
> > >  # something is wrong, call the sys-admin
> > >
> > >     group gohuman
> > >
> > > ##### mongrel 8002 - GoHuman #####
> > > check process mongrel-8002 with pidfile
> > > /home/admin/webapps/gohuman/shared/log/mongrel.8002.pid
> > >     start program = "/bin/rm -f
> > > /home/admin/webapps/gohuman/shared/log/mongrel.8002.pid && /usr/bin/su
> > > admin -c '/usr/local/bin/mongrel_rails start -d -e production -p 8002
> > > -a 127.0.0.1 -c /home/admin/webapps/gohuman/current -P
> > > log/mongrel.8002.pid'"
> > >     stop program  = "/usr/bin/su admin -c
> > > '/usr/local/bin/mongrel_rails stop -c
> > > /home/admin/webapps/gohuman/current -P log/mongrel.8002.pid'"
> > >
> > >     if totalmem is greater than 80.0 MB for 5 cycles then alert
> > >  # 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 3 restarts within 5 cycles then timeout
> > >  # something is wrong, call the sys-admin
> > >
> > >     group gohuman
> > > ------------
> > >
> > > Thanks,
> > > -carl
> > > --
> > > EPA Rating: 3000 Lines of Code / Gallon (of coffee)
> > > _______________________________________________
> > > 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)
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users
>



-- 
Corey Donohoe
http://www.atmos.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20070327/76866f74/attachment.html 


More information about the Mongrel-users mailing list