monit-general
[Top][All Lists]
Advanced

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

Re: How to check for a path in a url and restart runit if fails


From: David Montgomery
Subject: Re: How to check for a path in a url and restart runit if fails
Date: Thu, 12 Apr 2012 17:44:44 +0800

Here is the latest code.

check process pixelServer
   with pidfile "/etc/sv/pixelServer/supervise/pid"
   start program = "/bin/sh /home/ubuntu/test.sh"
   stop program = "/usr/bin/sv kill pixelServer"
   if failed host 127.0.0.1 port 80 protocol http
   request /pixel
   then exec "sh /home/ubuntu/test.sh"

in the test.sh file I have
#!/bin/sh
/usr/bin/sv kill pixelServer
/usr/bin/sv start pixelServer

When I slam the site..it breaks.  Looking at the logs sudo tail -f /var/log/monit while the site is being hit there is no indication that there is an issue.  In Monit I have a green light for hte pid file.  The site is down.  When I run sudo test.sh manually the site is back up.

sudo sh test.sh
ok: run: pixelServer: (pid 26309) 617s

After I manually restart I see this in the logs.
[UTC Apr 12 09:36:56] error    : 'pixelServer' process PID changed from 26309 to 2863
[UTC Apr 12 09:37:10] info     : 'pixelServer' process PID has not changed since last cycle


I can write my own python script and place it under runit control to monitor the heath of pixel but would prefer monit.  I am sure  am missing something but I just dont know what.  I suspect the issue is the pid file monitoring.  Instead of pid, what should I use?  Is it the socket issue? /tmp/nginx9002.socket?  Is that killed?

Thanks








On Thu, Apr 12, 2012 at 3:57 PM, Eric PAILLEAU <address@hidden> wrote:
Le 12/04/2012 09:06, David Montgomery a écrit :
Hi,  agreed about using restart as being more elegant. But I am having
and issues about restarting the runit service after I try and break it
under load using apache AB using a t1.micro.

if I use the below..the service will never restart.  the pixelServer
is a python web.py script executed using spawn-fcgi.  I am using nginx
and unix sockets (unixsocket /tmp/nginx9002.socket).

In monit...I still get a green light for the service as well


check process pixelServer
   with pidfile "/etc/sv/pixelServer/supervise/pid"
   start program = "/usr/bin/sv start pixelServer"
   stop program = "/usr/bin/sv kill pixelServer"
   if failed host 127.0.0.1 port 80 protocol http
   request /pixel
   then restart


Hi,
something like below may help.
This ensure that no process is still running before doing a start.
check process pixelServer with pidfile "/etc/sv/pixelServer/
supervise/pid" start program = "/usr/bin/killall pixelServer && sleep 2 ; usr/bin/sv start pixelServer" stop program = "/usr/bin/sv kill pixelServer" if failed host 127.0.0.1 port 80 protocol http request /pixel then restart



--

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general


reply via email to

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