[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
monit & http-timeout definitions.
From: |
eetu rantanen |
Subject: |
monit & http-timeout definitions. |
Date: |
Fri, 24 Oct 2003 16:48:55 +0300 (EET DST) |
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/tomcat.pid
start program = "/opt/tomcat/bin/safe_tomcat.sh start"
stop program = "/opt/tomcat/bin/kill_tomcat.sh"
if failed host webserver.somewhere.fi 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
unavailable
[ Oct 24 16:12:25] Event: 'tomcat' failed protocol test [HTTP] at
INET[photo.jippii.fi:80].
[ 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 webserver.somewhere.fi 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
- monit & http-timeout definitions.,
eetu rantanen <=