[Mongrel] Machine reboot - monit fails to start mongrels

Henry hpoydar at gmail.com
Thu Mar 29 12:04:14 EDT 2007


Thanks, Joey.  Do you mean the newest gem mongrel_cluster-0.2.1 or do  
you mean the 'prerelease' I've seen mentioned in this list?


On Mar 29, 2007, at 11:05 AM, Joey Geiger 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



More information about the Mongrel-users mailing list