<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: HOWTO: use monit to keep Lighttpd and Varnish running</title>
	<atom:link href="http://www.fak3r.com/2008/02/19/howto-use-monit-to-keep-lighttpd-and-varnish-running/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fak3r.com/2008/02/19/howto-use-monit-to-keep-lighttpd-and-varnish-running/</link>
	<description>dim high beams for oncoming traffic</description>
	<pubDate>Tue, 02 Dec 2008 04:32:43 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: Vasyl</title>
		<link>http://www.fak3r.com/2008/02/19/howto-use-monit-to-keep-lighttpd-and-varnish-running/#comment-27974</link>
		<dc:creator>Vasyl</dc:creator>
		<pubDate>Mon, 29 Sep 2008 02:13:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.fak3r.com/2008/02/19/howto-use-monit-to-keep-lighttpd-and-varnish-running/#comment-27974</guid>
		<description>I made it daemon &lt;code&gt;"set daemon"&lt;/code&gt; in monit.conf and it works OK with that config. Looks strange</description>
		<content:encoded><![CDATA[<p>I made it daemon <code>"set daemon"</code> in monit.conf and it works OK with that config. Looks strange</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fak3r</title>
		<link>http://www.fak3r.com/2008/02/19/howto-use-monit-to-keep-lighttpd-and-varnish-running/#comment-27960</link>
		<dc:creator>fak3r</dc:creator>
		<pubDate>Fri, 26 Sep 2008 14:07:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.fak3r.com/2008/02/19/howto-use-monit-to-keep-lighttpd-and-varnish-running/#comment-27960</guid>
		<description>Hey there, I *just* saw this issue at work the other day when I turned on some monit features to monitor some of our websites, and I came across a similar error.  While you have:

&lt;pre&gt;if failed host 1.2.3.4 port 80 protocol HTTP request / then restart
    if 5 restarts with 5 cycles then timeout&lt;/pre&gt;

I'm using:
&lt;pre&gt;check host DOMAIN.COM with address xxx.xxx.xxx.xxx
    if failed port 80 protocol http with timeout 45 seconds then alert&lt;/pre&gt;

I know it's only a slight syntax change, but that fixed it for me.  Try it out, if it doesn't fix it let me know and I'll plugin your syntax on my box and see what it does.  Also, for my nginx block I have more checks that you may want to consider:

&lt;pre&gt;check process nginx with pidfile /var/run/nginx.pid
        start program = "/etc/init.d/nginx start"
	stop program  = "/etc/init.d/nginx stop"
        if cpu &gt; 60% for 2 cycles then alert
	if cpu &gt; 80% for 5 cycles then restart
	if totalmem &gt; 200.0 MB for 5 cycles then restart
        if children &gt; 250 then restart
	if loadavg(5min) greater than 10 for 8 cycles then stop&lt;/pre&gt;

:wq!</description>
		<content:encoded><![CDATA[<p>Hey there, I *just* saw this issue at work the other day when I turned on some monit features to monitor some of our websites, and I came across a similar error.  While you have:</p>
<pre>if failed host 1.2.3.4 port 80 protocol HTTP request / then restart
    if 5 restarts with 5 cycles then timeout</pre>
<p>I&#8217;m using:</p>
<pre>check host DOMAIN.COM with address xxx.xxx.xxx.xxx
    if failed port 80 protocol http with timeout 45 seconds then alert</pre>
<p>I know it&#8217;s only a slight syntax change, but that fixed it for me.  Try it out, if it doesn&#8217;t fix it let me know and I&#8217;ll plugin your syntax on my box and see what it does.  Also, for my nginx block I have more checks that you may want to consider:</p>
<pre>check process nginx with pidfile /var/run/nginx.pid
        start program = "/etc/init.d/nginx start"
	stop program  = "/etc/init.d/nginx stop"
        if cpu > 60% for 2 cycles then alert
	if cpu > 80% for 5 cycles then restart
	if totalmem > 200.0 MB for 5 cycles then restart
        if children > 250 then restart
	if loadavg(5min) greater than 10 for 8 cycles then stop</pre>
<p>:wq!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vasyl</title>
		<link>http://www.fak3r.com/2008/02/19/howto-use-monit-to-keep-lighttpd-and-varnish-running/#comment-27957</link>
		<dc:creator>Vasyl</dc:creator>
		<pubDate>Fri, 26 Sep 2008 04:33:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.fak3r.com/2008/02/19/howto-use-monit-to-keep-lighttpd-and-varnish-running/#comment-27957</guid>
		<description>monit 4.9 on Centos 5 (monit from rpmforge) tries to monitor nginx 0.7.17 on the server with IP 1.2.3.4. with file /etc/monit.d/nginx:

check process nginx with pidfile /var/run/nginx.pid
  start program = "/etc/init.d/nginx start"
  stop program = "/etc/init.d/nginx stop"
  if failed host 1.2.3.4 port 80 protocol HTTP request / then restart
  if 5 restarts with 5 cycles then timeout


When trying to start:

# /etc/init.d/monit start
Starting Process Monitor (monit): HTTP error: Server returned status 400
'nginx' failed protocol test [HTTP] at INET[1.2.3.4:80] via TCP
'nginx' trying to restart
'nginx' stop: /etc/init.d/nginx
'nginx' failed to stop

and kills nginx :(

wget http://1.2.3.4/ returns:
# wget http://208.113.97.31
--21:31:49--  http://1.2.3.4/
Connecting to 1.2.3.4... connected.
HTTP request sent, awaiting response... 302
Location: /UnsupportedBrowser?returnUrl= [following]
--21:31:49--  http://1.2.3.4/UnsupportedBrowser?returnUrl=
Connecting to 1.2.3.4:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `UnsupportedBrowser?returnUrl=.2'

    [                                     ] 1,427       --.-K/s   in 0s

21:31:49 (136 MB/s) - `UnsupportedBrowser?returnUrl=.2' saved [1427]

Maybe something wrong with monit's http client? Any idea?</description>
		<content:encoded><![CDATA[<p>monit 4.9 on Centos 5 (monit from rpmforge) tries to monitor nginx 0.7.17 on the server with IP 1.2.3.4. with file /etc/monit.d/nginx:</p>
<p>check process nginx with pidfile /var/run/nginx.pid<br />
  start program = &#8220;/etc/init.d/nginx start&#8221;<br />
  stop program = &#8220;/etc/init.d/nginx stop&#8221;<br />
  if failed host 1.2.3.4 port 80 protocol HTTP request / then restart<br />
  if 5 restarts with 5 cycles then timeout</p>
<p>When trying to start:</p>
<p># /etc/init.d/monit start<br />
Starting Process Monitor (monit): HTTP error: Server returned status 400<br />
&#8216;nginx&#8217; failed protocol test [HTTP] at INET[1.2.3.4:80] via TCP<br />
&#8216;nginx&#8217; trying to restart<br />
&#8216;nginx&#8217; stop: /etc/init.d/nginx<br />
&#8216;nginx&#8217; failed to stop</p>
<p>and kills nginx <img src='http://www.fak3r.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>wget <a href="http://1.2.3.4/" onclick="javascript:pageTracker._trackPageview('/outbound/comment/1.2.3.4');" >http://1.2.3.4/</a> returns:<br />
# wget <a href="http://208.113.97.31" onclick="javascript:pageTracker._trackPageview('/outbound/comment/208.113.97.31');" >http://208.113.97.31</a><br />
&#8211;21:31:49&#8211;  <a href="http://1.2.3.4/" onclick="javascript:pageTracker._trackPageview('/outbound/comment/1.2.3.4');" >http://1.2.3.4/</a><br />
Connecting to 1.2.3.4&#8230; connected.<br />
HTTP request sent, awaiting response&#8230; 302<br />
Location: /UnsupportedBrowser?returnUrl= [following]<br />
&#8211;21:31:49&#8211;  <a href="http://1.2.3.4/UnsupportedBrowser?returnUrl=" onclick="javascript:pageTracker._trackPageview('/outbound/comment/1.2.3.4');" >http://1.2.3.4/UnsupportedBrowser?returnUrl=</a><br />
Connecting to 1.2.3.4:80&#8230; connected.<br />
HTTP request sent, awaiting response&#8230; 200 OK<br />
Length: unspecified [text/html]<br />
Saving to: `UnsupportedBrowser?returnUrl=.2&#8242;</p>
<p>    [                                     ] 1,427       &#8211;.-K/s   in 0s</p>
<p>21:31:49 (136 MB/s) - `UnsupportedBrowser?returnUrl=.2&#8242; saved [1427]</p>
<p>Maybe something wrong with monit&#8217;s http client? Any idea?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fak3r</title>
		<link>http://www.fak3r.com/2008/02/19/howto-use-monit-to-keep-lighttpd-and-varnish-running/#comment-27665</link>
		<dc:creator>fak3r</dc:creator>
		<pubDate>Thu, 01 May 2008 15:14:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.fak3r.com/2008/02/19/howto-use-monit-to-keep-lighttpd-and-varnish-running/#comment-27665</guid>
		<description>So, from lighty it looks like the error is:

&lt;code&gt;ErrorDocument 400 /error/invalidSyntax.html&lt;/code&gt;

At work I have monit watching Lighttpd without Varnish in the way, so its block in monitrc is this:

&lt;code&gt;check process lighttpd with pidfile /var/run/lighttpd.pid
     start program = "/etc/init.d/lighttpd start"
     stop program  = "/etc/init.d/lighttpd stop"
     if cpu &#62; 60% for 2 cycles then alert
     if cpu &#62; 80% for 5 cycles then restart
     if totalmem &#62; 200.0 MB for 5 cycles then restart
     if children &#62; 250 then restart
     if loadavg(5min) greater than 10 for 8 cycles then stop
     if failed host 127.0.0.1 port 80
           protocol HTTP request /monit_check.php
        timeout 20 seconds
        then restart
     if 3 restarts within 5 cycles then timeout
     depends on lighttpd_bin
     depends on lighttpd_rc
     group system&lt;/code&gt;

So, from your server, can you do something like: 

&lt;code&gt;wget http://127.0.0.1&lt;/code&gt; 

and get a successful response?  If not, you may want to place a 'dummy' file for it to grab (touch /var/www/test.html; chown www-data /var/www/test.html) so it'll give you a 200 - Success response:

&lt;code&gt;mbglinuxdevsrv01:/etc/monit# wget http://127.0.0.1/test.html
--2008-05-01 10:13:24--  http://127.0.0.1/test.html
Connecting to 127.0.0.1:80... connected.
HTTP request sent, awaiting response... 200 OK
[...]&lt;/code&gt;

I use a PHP file for monit to check so it can ensure that Fastcgi is still running, since a restart of Lighttpd would restart the Fastcgi process, although I'm going to start running that as a separate process so monit will watch it directly.  

Let me know, that should work.</description>
		<content:encoded><![CDATA[<p>So, from lighty it looks like the error is:</p>
<p><code>ErrorDocument 400 /error/invalidSyntax.html</code></p>
<p>At work I have monit watching Lighttpd without Varnish in the way, so its block in monitrc is this:</p>
<p><code>check process lighttpd with pidfile /var/run/lighttpd.pid<br />
     start program = "/etc/init.d/lighttpd start"<br />
     stop program  = "/etc/init.d/lighttpd stop"<br />
     if cpu &gt; 60% for 2 cycles then alert<br />
     if cpu &gt; 80% for 5 cycles then restart<br />
     if totalmem &gt; 200.0 MB for 5 cycles then restart<br />
     if children &gt; 250 then restart<br />
     if loadavg(5min) greater than 10 for 8 cycles then stop<br />
     if failed host 127.0.0.1 port 80<br />
           protocol HTTP request /monit_check.php<br />
        timeout 20 seconds<br />
        then restart<br />
     if 3 restarts within 5 cycles then timeout<br />
     depends on lighttpd_bin<br />
     depends on lighttpd_rc<br />
     group system</code></p>
<p>So, from your server, can you do something like: </p>
<p><code>wget <a href="http://127.0.0.1" onclick="javascript:pageTracker._trackPageview('/outbound/comment/127.0.0.1');" >http://127.0.0.1</a></code> </p>
<p>and get a successful response?  If not, you may want to place a &#8216;dummy&#8217; file for it to grab (touch /var/www/test.html; chown www-data /var/www/test.html) so it&#8217;ll give you a 200 - Success response:</p>
<p><code>mbglinuxdevsrv01:/etc/monit# wget <a href="http://127.0.0.1/test.html" onclick="javascript:pageTracker._trackPageview('/outbound/comment/127.0.0.1');" >http://127.0.0.1/test.html</a><br />
&#8211;2008-05-01 10:13:24&#8211;  <a href="http://127.0.0.1/test.html" onclick="javascript:pageTracker._trackPageview('/outbound/comment/127.0.0.1');" >http://127.0.0.1/test.html</a><br />
Connecting to 127.0.0.1:80&#8230; connected.<br />
HTTP request sent, awaiting response&#8230; 200 OK<br />
[...]</code></p>
<p>I use a PHP file for monit to check so it can ensure that Fastcgi is still running, since a restart of Lighttpd would restart the Fastcgi process, although I&#8217;m going to start running that as a separate process so monit will watch it directly.  </p>
<p>Let me know, that should work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus Herou</title>
		<link>http://www.fak3r.com/2008/02/19/howto-use-monit-to-keep-lighttpd-and-varnish-running/#comment-27664</link>
		<dc:creator>Marcus Herou</dc:creator>
		<pubDate>Wed, 30 Apr 2008 07:11:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.fak3r.com/2008/02/19/howto-use-monit-to-keep-lighttpd-and-varnish-running/#comment-27664</guid>
		<description>Hi.

Nice article. However my lighttpd instance only throws a 400 error.
monit[9262]: HTTP error: Server returned status 400

My app server is monitored the exact same way as lighttpd but no error.

check process lighttpd with pidfile /var/run/lighttpd.pid
   group root
   start program = "/etc/init.d/lighttpd start"
   stop  program = "/etc/init.d/lighttpd stop"
   if failed host 192.168.10.6 port 80 protocol http
        then restart
        alert XXXX@XXXX with the mail-format { subject: Alarm Webserver is down! }
   if 5 restarts within 5 cycles then timeout

Any ideas ?</description>
		<content:encoded><![CDATA[<p>Hi.</p>
<p>Nice article. However my lighttpd instance only throws a 400 error.<br />
monit[9262]: HTTP error: Server returned status 400</p>
<p>My app server is monitored the exact same way as lighttpd but no error.</p>
<p>check process lighttpd with pidfile /var/run/lighttpd.pid<br />
   group root<br />
   start program = &#8220;/etc/init.d/lighttpd start&#8221;<br />
   stop  program = &#8220;/etc/init.d/lighttpd stop&#8221;<br />
   if failed host 192.168.10.6 port 80 protocol http<br />
        then restart<br />
        alert XXXX@XXXX with the mail-format { subject: Alarm Webserver is down! }<br />
   if 5 restarts within 5 cycles then timeout</p>
<p>Any ideas ?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
