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
Joey Geiger
2007-Mar-29 15:05 UTC
[Mongrel] Machine reboot - monit fails to start mongrels
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
>
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
Joey Geiger
2007-Mar-29 18:00 UTC
[Mongrel] Machine reboot - monit fails to start mongrels
1.0.x something. It would be the pre-release as of right now I guess. On 3/29/07, Henry <hpoydar at gmail.com> wrote:> 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 > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >
Carl Lerche
2007-Mar-30 02:26 UTC
[Mongrel] Machine reboot - monit fails to start mongrels
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)