Hi, I tried to make monit up on my server to manage ruby on rails application. I have some problem when i try to start monit : [root@seb seb]# /usr/local/bin/monit start all ''mongrel_rails_3003'' start: /usr/bin/ruby ''mongrel_rails_3003'' failed to start [root@seb seb]# monit status monit: no status available -- the monit daemon is not running my monitrc file is in /usr/local/src/monitrc : --------- set daemon 30 set logfile /var/log/monit.log set mailserver 127.0.0.1 set mail-format {from:watchseb-3Q2Tfjf0mexWk0Htik3J/w@public.gmane.org} set alert friofool-3Q2Tfjf0mexWk0Htik3J/w@public.gmane.org only on {timeout, nonexist} set httpd port 4000 include /home/seb/watchdog/* --------- my application config file in /home/seb/watchdog/ : --------- check process mongrel_rails_3003 with pidfile /var/run/mongrel/mongrel.3003.pid start program = "/usr/bin/ruby /usr/bin/mongrel_rails cluster::start -C /home/seb/railsproject/cpericard/config/mongrel_cluster.yml --clean --only 3003" stop program = "/usr/bin/ruby /usr/bin/mongrel_rails cluster::stop -C /home/seb/railsproject/cpericard/config/mongrel_cluster.yml --only 3003" if totalmem > 100.0 MB for 5 cycles then restart if failed host 127.0.0.1 port 3003 protocol http with timeout 10 seconds then restart --------- The mongrel process start but monit daemon is not running. What''s wrong with my configuration ? Thanks a lot for your help ! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frioffol Friofool wrote:> Hi, > > I tried to make monit up on my server to manage ruby on rails > application. > I have some problem when i try to start monit : >Hi, What do you get when you run: # /usr/local/bin/monit -t -c /usr/local/src/monitrc Daniel -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m not sure you need to include the ''/usr/bin/ruby'' in your start program. The following setup works for me: check process mongrel-8007 with pidfile /var/zena/current/log/mongrel. 8007.pid start program = "/var/lib/gems/1.8/bin/mongrel_rails start -d -e production -p 8007 -a 127.0.0.1 -P log/mongrel.8007.pid -c /var/zena/ current" --user www-data --group www-data stop program = "/var/lib/gems/1.8/bin/mongrel_rails stop -P log/ mongrel.8007.pid -c /var/zena/current" Gaspard> > Hi, > > I tried to make monit up on my server to manage ruby on rails > application. > I have some problem when i try to start monit : > > [root@seb seb]# /usr/local/bin/monit start all > ''mongrel_rails_3003'' start: /usr/bin/ruby > ''mongrel_rails_3003'' failed to start > > [root@seb seb]# monit status > monit: no status available -- the monit daemon is not running > > my monitrc file is in /usr/local/src/monitrc : > > --------- > set daemon 30 > set logfile /var/log/monit.log > set mailserver 127.0.0.1 > set mail-format {from:watchseb-3Q2Tfjf0mexWk0Htik3J/w@public.gmane.org} > set alert friofool-3Q2Tfjf0mexWk0Htik3J/w@public.gmane.org only on {timeout, nonexist} > set httpd port 4000 > include /home/seb/watchdog/* > --------- > > my application config file in /home/seb/watchdog/ : > > --------- > check process mongrel_rails_3003 > with pidfile /var/run/mongrel/mongrel.3003.pid > start program = "/usr/bin/ruby /usr/bin/mongrel_rails > cluster::start -C > /home/seb/railsproject/cpericard/config/mongrel_cluster.yml --clean > --only 3003" > stop program = "/usr/bin/ruby /usr/bin/mongrel_rails > cluster::stop -C > /home/seb/railsproject/cpericard/config/mongrel_cluster.yml --only > 3003" > if totalmem > 100.0 MB for 5 cycles then restart > if failed host 127.0.0.1 port 3003 protocol http with timeout 10 > seconds > then restart > --------- > > The mongrel process start but monit daemon is not running. > > What''s wrong with my configuration ? > > Thanks a lot for your help ! > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Daniel Bush wrote:> Frioffol Friofool wrote: >> Hi, >> >> I tried to make monit up on my server to manage ruby on rails >> application. >> I have some problem when i try to start monit : >> > > Hi, > What do you get when you run: > # /usr/local/bin/monit -t -c /usr/local/src/monitrc > > Daniel[root@seb cpericard]# /usr/local/bin/monit -t -c /usr/local/etc/monitrc Control file syntax OK -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Monit does NOT get the normal path information that a regular user on the server would get so you have to be VERY specific in you configuration files. Some times the best solution is to create a startup script that you call from monit... script: #!/bin/bash # Get the port number PORT=$2 # Set the initial path export PATH=${PATH}:/usr/bin:/usr/local/bin start () { mongrel_rails cluster::start --config $CONFIG_FILE --clean --only $PORT } stop () { mongrel_rails cluster::stop --config $CONFIG_FILE --clean -- only $PORT --force } case $1 in start) start ;; stop) stop ;; *) echo $"Usage: $0 {start|stop} port" exit 1 ;; esac exit 0 Now you can call it from monit like this: start program = "/usr/local/bin/script.sh start 8000" stop program = "/usr/local/bin/script.sh stop 8000" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Gaspard Bucher wrote:> I''m not sure you need to include the ''/usr/bin/ruby'' in your start > program. The following setup works for me: > > check process mongrel-8007 with pidfile /var/zena/current/log/mongrel. > 8007.pid > start program = "/var/lib/gems/1.8/bin/mongrel_rails start -d -e > production -p 8007 -a 127.0.0.1 -P log/mongrel.8007.pid -c /var/zena/ > current" --user www-data --group www-data > stop program = "/var/lib/gems/1.8/bin/mongrel_rails stop -P log/ > mongrel.8007.pid -c /var/zena/current" > > > Gaspardi have updated my monitrc file : ------- set daemon 60 set httpd port 2812 and use address 127.0.0.1 allow 127.0.0.1 check process mongrel-3003 with pidfile /home/seb/railsproject/cpericard/log/mongrel.3003.pid start program = "/usr/bin/mongrel_rails start -d -e development -p 3003 -a 127.0.0.1 -P /home/seb/railsproject/cpericard/log/mongrel.3003.pid -c /home/seb/railsproject/cpericard" stop program = "/usr/bin/mongrel_rails stop -P /home/seb/railsproject/cpericard/log/mongrel.3003.pid -c /home/seb/railspoject/cpericard" group mongrel ------- when i try to start monit : [root@seb cpericard]# /usr/local/bin/monit start all ''mongrel-3003'' start: /usr/bin/mongrel_rails ''mongrel-3003'' failed to start monit daemon is not starting but mongrel is working ! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Try running your start program without any environment variables (as it is probably run by monit): # env -i /usr/bin/mongrel_rails start -d -e development -p 3003 -a 127.0.0.1 -P /home/seb/railsproject/cpericard/log/mongrel.3003.pid -c / home/seb/railsproject/cpericard Make sure "which mongrel_rails" gives /usr/bin/mongrel_rails I had to use (debian) /var/lib/gems/1.8/bin/mongrel_rails Gaspard> > Gaspard Bucher wrote: >> I''m not sure you need to include the ''/usr/bin/ruby'' in your start >> program. The following setup works for me: >> >> check process mongrel-8007 with pidfile /var/zena/current/log/ >> mongrel. >> 8007.pid >> start program = "/var/lib/gems/1.8/bin/mongrel_rails start -d -e >> production -p 8007 -a 127.0.0.1 -P log/mongrel.8007.pid -c /var/zena/ >> current" --user www-data --group www-data >> stop program = "/var/lib/gems/1.8/bin/mongrel_rails stop -P log/ >> mongrel.8007.pid -c /var/zena/current" >> >> >> Gaspard > > i have updated my monitrc file : > > ------- > set daemon 60 > > set httpd port 2812 and > use address 127.0.0.1 > allow 127.0.0.1 > > check process mongrel-3003 with pidfile > /home/seb/railsproject/cpericard/log/mongrel.3003.pid > start program = "/usr/bin/mongrel_rails start -d -e development -p > 3003 -a 127.0.0.1 -P > /home/seb/railsproject/cpericard/log/mongrel.3003.pid -c > /home/seb/railsproject/cpericard" > stop program = "/usr/bin/mongrel_rails stop -P > /home/seb/railsproject/cpericard/log/mongrel.3003.pid -c > /home/seb/railspoject/cpericard" > group mongrel > ------- > > when i try to start monit : > > [root@seb cpericard]# /usr/local/bin/monit start all > ''mongrel-3003'' start: /usr/bin/mongrel_rails > ''mongrel-3003'' failed to start > > monit daemon is not starting but mongrel is working ! > > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Gaspard Bucher wrote:> Try running your start program without any environment variables (as > it is probably run by monit): > > # env -i /usr/bin/mongrel_rails start -d -e development -p 3003 -a > 127.0.0.1 -P /home/seb/railsproject/cpericard/log/mongrel.3003.pid -c / > home/seb/railsproject/cpericard > > Make sure "which mongrel_rails" gives > /usr/bin/mongrel_rails > > I had to use (debian) > /var/lib/gems/1.8/bin/mongrel_rails > > Gaspardthat''s better, monit is starting but ... not my rails app my monitrc file : ----- set daemon 60 set httpd port 2812 and use address 127.0.0.1 allow 127.0.0.1 check process mongrel-3003 with pidfile /home/seb/railsproject/cpericard/log/mongrel.3003.pid start program = "/bin/env -i /usr/bin/mongrel_rails start -d -e development -p 3003 -a 127.0.0.1 -P /home/seb/railsproject/cpericard/log/mongrel.3003.pid -c /home/seb/railsproject/cpericard" stop program = "/bin/env -i /usr/bin/mongrel_rails stop -P /home/seb/railsproject/cpericard/log/mongrel.3003.pid -c /home/seb/railsproject/cpericard" group mongrel ---- [root@seb cpericard]# which mongrel_rails /usr/bin/mongrel_rails [root@seb cpericard]# /usr/local/bin/monit Starting monit daemon with http interface at [127.0.0.1:2812] [root@seb cpericard]# monit status The monit daemon 4.10.1 uptime: 0m Process ''mongrel-3003'' status Execution failed monitoring status monitored data collected Tue Oct 7 17:16:52 2008 System ''seb'' status Monit instance changed monitoring status monitored load average [0.04] [0.07] [0.08] cpu 0.0%us 0.0%sy 0.0%wa memory usage 399392 kB [77.6%] data collected Tue Oct 7 17:16:52 2008 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You misunderstood me. Try running your command * in the shell * to test it first. You also get any error messages. So you should type: # env -i /usr/bin/mongrel_rails start -d -e development -p 3003 -a 127.0.0.1 -P /home/seb/railsproject/cpericard/log/mongrel.3003.pid -c / home/seb/railsproject/cpericard and see how it works. Setting "env -i" in the shell reproduces the environment used in monit, so it lets you test your command as if it was run by monit. Gaspard> > Gaspard Bucher wrote: >> Try running your start program without any environment variables (as >> it is probably run by monit): >> >> # env -i /usr/bin/mongrel_rails start -d -e development -p 3003 -a >> 127.0.0.1 -P /home/seb/railsproject/cpericard/log/mongrel.3003.pid - >> c / >> home/seb/railsproject/cpericard >> >> Make sure "which mongrel_rails" gives >> /usr/bin/mongrel_rails >> >> I had to use (debian) >> /var/lib/gems/1.8/bin/mongrel_rails >> >> Gaspard > > that''s better, monit is starting but ... not my rails app > > my monitrc file : > > ----- > set daemon 60 > > set httpd port 2812 and > use address 127.0.0.1 > allow 127.0.0.1 > > check process mongrel-3003 with pidfile > /home/seb/railsproject/cpericard/log/mongrel.3003.pid > start program = "/bin/env -i /usr/bin/mongrel_rails start -d -e > development -p 3003 -a 127.0.0.1 -P > /home/seb/railsproject/cpericard/log/mongrel.3003.pid -c > /home/seb/railsproject/cpericard" > stop program = "/bin/env -i /usr/bin/mongrel_rails stop -P > /home/seb/railsproject/cpericard/log/mongrel.3003.pid -c > /home/seb/railsproject/cpericard" > group mongrel > ---- > > [root@seb cpericard]# which mongrel_rails > /usr/bin/mongrel_rails > [root@seb cpericard]# /usr/local/bin/monit > Starting monit daemon with http interface at [127.0.0.1:2812] > [root@seb cpericard]# monit status > The monit daemon 4.10.1 uptime: 0m > > Process ''mongrel-3003'' > status Execution failed > monitoring status monitored > data collected Tue Oct 7 17:16:52 2008 > > System ''seb'' > status Monit instance changed > monitoring status monitored > load average [0.04] [0.07] [0.08] > cpu 0.0%us 0.0%sy 0.0%wa > memory usage 399392 kB [77.6%] > data collected Tue Oct 7 17:16:52 2008 > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Gaspard Bucher wrote:> You misunderstood me. Try running your command * in the shell * > to test it first. You also get any error messages. So you should type: > > # env -i /usr/bin/mongrel_rails start -d -e development -p 3003 -a > 127.0.0.1 -P /home/seb/railsproject/cpericard/log/mongrel.3003.pid -c / > home/seb/railsproject/cpericard > > and see how it works. > > Setting "env -i" in the shell reproduces the environment used in > monit, so it lets you test your command as if it was run by monit. > > Gaspardsorry ! and thanks for your help gaspard i tried this command and mongrel is starting. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frioffol Friofool wrote:> Gaspard Bucher wrote: >> You misunderstood me. Try running your command * in the shell * >> to test it first. You also get any error messages. So you should type: >> >> # env -i /usr/bin/mongrel_rails start -d -e development -p 3003 -a >> 127.0.0.1 -P /home/seb/railsproject/cpericard/log/mongrel.3003.pid -c / >> home/seb/railsproject/cpericard >> >> and see how it works. >> >> Setting "env -i" in the shell reproduces the environment used in >> monit, so it lets you test your command as if it was run by monit. >> >> Gaspard > > sorry ! and thanks for your help gaspard > > i tried this command and mongrel is starting.now it''s working ! i didn''t change anything. my definitive conf file is : set daemon 60 set httpd port 2812 and use address 127.0.0.1 allow 127.0.0.1 check process mongrel-3003 with pidfile /home/seb/railsproject/cpericard/log/mongrel.3003.pid start program = "/usr/bin/mongrel_rails start -d -e development -p 3003 -a 127.0.0.1 -P /home/seb/railsproject/cpericard/log/mongrel.3003.pid -c /home/seb/railsproject/cpericard" stop program = "/usr/bin/mongrel_rails stop -P /home/seb/railsproject/cpericard/log/mongrel.3003.pid -c /home/seb/railsproject/cpericard" group mongrel thanks for all your help ! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---