<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>Recent Posts in 'Monit and Mongrel' | Pragmatic Forums</title>
    <link>http://forums.pragprog.com/forums/44/topics/318</link>
    <language>en-us</language>
    <ttl>60</ttl>
    <description></description>
    <item>
      <title>Monit and Mongrel posted by Dave Rothlisberger @ Mon, 07 Jul 2008 19:53:39 -0000</title>
      <description>&lt;p&gt;If monit doesn&amp;#8217;t seem to be starting your mongrels, check the mongrel log; from here I learned that the &lt;span class="caps"&gt;HOME&lt;/span&gt; path wasn&amp;#8217;t set.&lt;/p&gt;


	&lt;p&gt;My start and stop monit commands both set the &lt;span class="caps"&gt;PATH&lt;/span&gt; and &lt;span class="caps"&gt;HOME&lt;/span&gt; environment variables, and monit now happily starts/stops my mongrels:&lt;/p&gt;


	&lt;p&gt;start = &amp;#8221;/usr/bin/env &lt;span class="caps"&gt;PATH&lt;/span&gt;=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin &lt;span class="caps"&gt;HOME&lt;/span&gt;=/home/rails mongrel_rails cluster::start -C /home/rails/app/current/config/mongrel_cluster.yml&amp;#8212;clean&amp;#8212;only 8000&amp;#8221;&lt;/p&gt;


	&lt;p&gt;stop = &amp;#8221;/usr/bin/env &lt;span class="caps"&gt;PATH&lt;/span&gt;=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin &lt;span class="caps"&gt;HOME&lt;/span&gt;=/home/rails mongrel_rails cluster::stop -C /home/rails/app/current/config/mongrel_cluster.yml&amp;#8212;clean&amp;#8212;only 8000&amp;#8221;&lt;/p&gt;


	&lt;p&gt;&lt;span class="caps"&gt;HTH&lt;/span&gt;&lt;/p&gt;</description>
      <pubDate>Mon, 07 Jul 2008 19:53:39 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:44:318:3488</guid>
      <author>Dave Rothlisberger</author>
      <link>http://forums.pragprog.com/forums/44/topics/318</link>
    </item>
    <item>
      <title>Monit and Mongrel posted by Jay @ Sat, 07 Jun 2008 20:31:13 -0000</title>
      <description>&lt;p&gt;The answer for me at long last was to set &lt;span class="caps"&gt;GEM&lt;/span&gt;_HOME in the mongrel.monitrc file.  So&lt;br /&gt;start program = &amp;#8220;env &lt;span class="caps"&gt;GEM&lt;/span&gt;_HOME=&amp;lt;path to gems&gt; /usr/local/bin/mongrel_rails cluster::start -C &amp;#8230;&lt;/p&gt;</description>
      <pubDate>Sat, 07 Jun 2008 20:31:13 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:44:318:3095</guid>
      <author>Jay</author>
      <link>http://forums.pragprog.com/forums/44/topics/318</link>
    </item>
    <item>
      <title>Monit and Mongrel posted by Jay @ Sat, 07 Jun 2008 05:41:08 -0000</title>
      <description>&lt;p&gt;Frank, I tried your solution by linking /usr/local/bin/mongrel_rails to /usr/local/lib/site_ruby/gems/bin/mongrel_rails which is how my Debian Etch config is set up.  Still experiencing the same issues you described on the 14th.  Here&amp;#8217;s some more data:&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve included the mongrel.monitrc file I&amp;#8217;m using.  If you issue the start&lt;br /&gt;program and stop program commands shown in that file from the command&lt;br /&gt;line, they work fine, regardless of what directory you issue them&lt;br /&gt;from.  Interestingly, calling &amp;#8220;monit status&amp;#8221; does show that the&lt;br /&gt;test3_8001 process is being monitored and shows the correct statistics&lt;br /&gt;for uptime, etc.  However, when you run &amp;#8220;monit restart test3_8001&amp;#8221; &lt;br /&gt;there is a failure.  &amp;#8220;monit status&amp;#8221; eventually shows &amp;#8220;Execution&lt;br /&gt;failed&amp;#8221; as a status for test3_8001, but does continue to show all the&lt;br /&gt;other correct stats as before.  Checking the monit_errors.log shows&lt;br /&gt;only the following:&lt;br /&gt;488 [PDT Jun  6 20:56:22] info     : &amp;#8216;mongrel_test3_8001&amp;#8217; trying to&lt;br /&gt;restart&lt;br /&gt;489 [PDT Jun  6 20:56:22] info     : &amp;#8216;mongrel_test3_8001&amp;#8217; start: /usr/&lt;br /&gt;bin/env&lt;br /&gt;490 [PDT Jun  6 20:56:23] error    : &amp;#8216;mongrel_test3_8001&amp;#8217; failed to&lt;br /&gt;stop&lt;/p&gt;


	&lt;p&gt;Other notes:&lt;br /&gt;- Paths&lt;br /&gt;&lt;del&gt;&amp;#8212;&amp;gt;  I tried just having the /usr/local/lib/site_ruby/gems/bin/&lt;br /&gt;mongrel_rails cluster::start -C /home/jay/test/testing/config/&lt;br /&gt;mongrel_cluster.yml&amp;#8212;clean&amp;#8212;only 8001&amp;#8221; as a path&lt;br /&gt;&lt;/del&gt;&amp;#8212;&amp;gt; I also tried adding the path to the ruby executable which is /usr/&lt;br /&gt;local/bin/ruby on my machine prior to the above.&lt;/p&gt;


	&lt;p&gt;the mongrel.monitrc file:&lt;/p&gt;


check process test3_8001
  with pidfile /home/jay/test/testing/tmp/pids/mongrel.8001.pid
  start program = &amp;#8221;/usr/bin/env &lt;span class="caps"&gt;PATH&lt;/span&gt;=$PATH:/usr/local/lib/site_ruby/&lt;br /&gt;gems/bin /usr/local/lib/site_ruby/gems/bin/mongrel_rails&lt;br /&gt;cluster::start &lt;del&gt;C /home/jay/test/testing/config/mongrel_cluster.yml -&lt;/del&gt;&lt;br /&gt;clean&amp;#8212;only 8001&amp;#8221; 
  stop program = &amp;#8221;//usr/bin/env &lt;span class="caps"&gt;PATH&lt;/span&gt;=$PATH:/usr/local/lib/site_ruby/&lt;br /&gt;gems/bin /usr/local/lib/site_ruby/gems/bin/mongrel_rails cluster::stop&lt;br /&gt;-C /home/jay/test/testing/config/mongrel_cluster.yml&amp;#8212;only 8001&amp;#8221; 
	&lt;ol&gt;
	&lt;li&gt;   if cpu &amp;gt; 60% for 2 cycles then alert
  if cpu &amp;gt; 80% for 4 cycles then restart
  if totalmem &amp;gt; 110.0 MB for 4 cycles then restart&lt;/li&gt;
		&lt;li&gt;   if children &amp;gt; 250 then restart&lt;/li&gt;
		&lt;li&gt;   if loadavg(5min) greater than 10 for 8 cycles then stop&lt;/li&gt;
		&lt;li&gt;   if failed host &lt;a href="http://www.tildeslash.com"&gt;www.tildeslash.com&lt;/a&gt; port 80 protocol http&lt;/li&gt;
		&lt;li&gt;      and request &amp;#8221;/monit/doc/next.php&amp;#8221; &lt;/li&gt;
		&lt;li&gt;      then restart&lt;/li&gt;
		&lt;li&gt;   if failed port 443 type tcpssl protocol http&lt;/li&gt;
		&lt;li&gt;      with timeout 15 seconds&lt;/li&gt;
		&lt;li&gt;      then restart
  if 20 restarts within 20 cycles then timeout&lt;/li&gt;
		&lt;li&gt;   depends on apache_bin
  group test_mongrels&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;Thanks for any thoughts &amp;#8211; I&amp;#8217;m at a loss&amp;#8230;&lt;/p&gt;


	&lt;p&gt;&lt;span class="caps"&gt;JBB&lt;/span&gt;&lt;/p&gt;</description>
      <pubDate>Sat, 07 Jun 2008 05:41:08 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:44:318:3091</guid>
      <author>Jay</author>
      <link>http://forums.pragprog.com/forums/44/topics/318</link>
    </item>
    <item>
      <title>Monit and Mongrel posted by Frank @ Fri, 14 Mar 2008 19:16:25 -0000</title>
      <description>&lt;p&gt;I&amp;#8217;ve been able to come up with a solution to this problem. The solution is to add the following line to /usr/local/bin/mongrel_rails&lt;/p&gt;


	&lt;p&gt;&lt;span class="caps"&gt;ENV&lt;/span&gt;[&amp;#8216;PATH&amp;#8217;] = &amp;#8221;#{ENV[&amp;#8216;PATH&amp;#8217;]}:/usr/local/bin&amp;#8221;;&lt;/p&gt;


	&lt;p&gt;and then to have the stop/start commands in the monit config look as follows:&lt;/p&gt;


	&lt;p&gt;start program = &#8221;/usr/local/bin/mongrel_rails cluster::start -C /home/virtual/rails/myapp/current/config/mongrel_cluster.yml&#8212;clean&#8212;only 5050&#8221;&lt;/p&gt;


	&lt;p&gt;stop program = &amp;#8221;/usr/local/bin/mongrel_rails cluster::stop -C /home/virtual/rails/myapp/current/config/mongrel_cluster.yml&amp;#8212;only 5050&amp;#8221;&lt;/p&gt;


	&lt;p&gt;This isn&amp;#8217;t really an ideal solution as my monit monitoring will break whenever I upgrade the mongrel_cluster gem.&lt;/p&gt;</description>
      <pubDate>Fri, 14 Mar 2008 19:16:25 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:44:318:2447</guid>
      <author>Frank</author>
      <link>http://forums.pragprog.com/forums/44/topics/318</link>
    </item>
    <item>
      <title>Monit and Mongrel posted by Frank @ Fri, 14 Mar 2008 19:05:02 -0000</title>
      <description>&lt;p&gt;I&amp;#8217;ve tried many different ways of specifying the start and stop commands in monit. For example, I just tried this:&lt;/p&gt;


	&lt;p&gt;start program = &amp;#8221;/usr/bin/env &lt;span class="caps"&gt;PATH&lt;/span&gt;=/usr/local/bin:${PATH} mongrel_rails cluster::start -C /home/virtual/rails/myapp/current/config/mongrel_cluster.yml&amp;#8212;clean&amp;#8212;only 5050&amp;#8221;&lt;/p&gt;


	&lt;p&gt;stop program = &amp;#8221;/usr/bin/env &lt;span class="caps"&gt;PATH&lt;/span&gt;=/usr/local/bin:${PATH} mongrel_rails cluster::stop -C /home/virtual/rails/myapp/current/config/mongrel_cluster.yml&amp;#8212;only 5050&amp;#8221;&lt;/p&gt;


	&lt;p&gt;and still the monit log file reports:&lt;/p&gt;


	&lt;p&gt;[ Mar 14 11:43:07] info     : &amp;#8216;mongrel_myapp_5050&amp;#8217; stop: /usr/bin/env&lt;br /&gt;[ Mar 14 11:43:37] error    : &amp;#8216;mongrel_myapp_5050&amp;#8217; failed to stop&lt;/p&gt;


	&lt;p&gt;I am able to run those stop start commands manually from a shell in which I set the initial path to be the same one that monit sets (/bin:/usr/bin:/sbin:/usr/sbin) so I have no idea why it doesn&amp;#8217;t work through monit.&lt;/p&gt;


	&lt;p&gt;Is there anyway to actually debug monit and see what its actually executing and see what error message it might encounter when trying to stop or start a program?&lt;/p&gt;</description>
      <pubDate>Fri, 14 Mar 2008 19:05:02 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:44:318:2446</guid>
      <author>Frank</author>
      <link>http://forums.pragprog.com/forums/44/topics/318</link>
    </item>
    <item>
      <title>Monit and Mongrel posted by Frank @ Fri, 14 Mar 2008 05:48:26 -0000</title>
      <description>&lt;p&gt;I recently picked up the beta version of Deploying Rails Applications and I&amp;#8217;m trying to use the information in the book to setup monit to monitor and restart my cluster of mongrels.&lt;/p&gt;


	&lt;p&gt;I can get monit to monitor my mongrels but I haven&amp;#8217;t been able to get monit to be able to stop or start my mongrels. The problem seems to be related to the spartan path that monit provides when starting or stopping programs. That path is &lt;span class="caps"&gt;PATH&lt;/span&gt;=/bin:/usr/bin:/sbin:/usr/sbin&lt;/p&gt;


	&lt;p&gt;And on my particular FreeBSD 6.3 system I cannot run the mongrel_rails command successfully unless /usr/local/bin is part of my path. If I run mongrel_rails without /usr/local/bin in my path I am rewarded with this error:&lt;/p&gt;


	&lt;p&gt;/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27: command not found:&lt;/p&gt;


	&lt;p&gt;Anyone else encounter this? Any ideas on how to solve it?&lt;/p&gt;</description>
      <pubDate>Fri, 14 Mar 2008 05:48:26 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:44:318:2443</guid>
      <author>Frank</author>
      <link>http://forums.pragprog.com/forums/44/topics/318</link>
    </item>
  </channel>
</rss>
