[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: monit & http-timeout definitions.

From: Martin Pala
Subject: Re: monit & http-timeout definitions.
Date: Sun, 26 Oct 2003 19:23:59 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031020 Debian/1.5-1

eetu rantanen wrote:

Hi all,

I've setup monit to restart an tomcat serving a dynamic webpage. As we all
know, these tomcats tend to either consume all the memory the box has, or
then just mysteriously slow down until they do nothing but busyloop.
Anyway, they need a periodical restart every now and then ;-)

My configuration is like this:

 check process tomcat with pidfile /tmp/
   start program = "/opt/tomcat/bin/ start"
   stop program  = "/opt/tomcat/bin/"
   if failed host port 80 protocol http
      and request "/fi/index.html" then restart
   if cpu is greater than 80% for 8 cycles then restart
   if loadavg(15min) greater than 10 for 8 cycles then restart
   if totalmem > 300.0 MB for 8 cycles then restart
   if 3 restarts within 5 cycles then timeout
   alert address@hidden
   group server

I then got this into the log (it worked ok, this was a problem which monit
then automatically cured:) :

[ Oct 24 16:12:25] HTTP: error receiving data -- Resource temporarily 
[ Oct 24 16:12:25] Event: 'tomcat' failed protocol test [HTTP] at 
[ Oct 24 16:12:25] Trying to restart 'tomcat'

How does monit get this 'error receiving data'? The datastream stops for a
while from the tcp-socket to the webserver?

The tomcat is a bit lazy sometimes to reply to the requests, and takes a
little time to process them. I was wondering if there is a
timeout-statement that I could use? Like this:

   if failed host port 80 protocol http
      and request "/fi/index.html" then restart
                if timeout 15 restart

So if the HTTP-request (the time from opening the socket to getting the
last bytes from the server) takes more than 15 seconds it would restart
the tomcat. This could also prevent these 'Resource temporarily
unavailable' -errors from restarting the tomcat when the time consumed to
the request is less than 15 seconds.

Can this be done? Other ideas? Comments? :)

Have a nice weekend,
Eetu Rantanen

To unsubscribe:

since 4.0 monit has optional socket timeout definition like this:

  if failed port 443 type tcpssl proto http with timeout 15 seconds

By default monit uses 5 seconds.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]