[Glass] Swazoo server hangs

Paul DeBruicker pdebruic at gmail.com
Fri Nov 15 13:44:47 PST 2013


Hi Otto & Johan- 

Just to offer another example I have not been using monit and instead have a bash script controlled by daemontools like this:


#!/bin/bash
# named httpServerHealthCheck.sh
SERVICE_TO_MONITOR=/etc/service/gs_fastcgi-9001
sleep 30
curl -R -O http://127.0.0.1/f9001
RESULT=`awk 'NR=1{print $1}' f9001`
if [ "$RESULT" != "/f9001" ] ; then
  svc -t $SERVICE_TO_MONITOR
  echo `date` "-" $SERVICE_TO_MONITOR "was restarted." ;
fi


and in my nginx config have a location block like this:

location /f9001 {
      fastcgi_pass localhost:9001;
}

The bash script:
1. Sleeps for 30 seconds

2. uses curl to access a nonexistent seaside app so I get the standard Seaside 'not found' error (.e.g. "/f9001 not found") stored into a file 'f9001' next to the bash script.  

3. the bash script then uses awk to store the first bit of the downloaded file in the RESULT variable.

4. the RESULT variable is then compared with the expected result, and if not found, the Gem is restarted by daemontools.

5. the bash script exits

daemontools monitors the bash script and restarts it shortly after it stops running

the daemontools 'run' script is:

#!/bin/sh
exec ./httpServerHealthCheck.sh




Hope this helps

Paul




On Nov 15, 2013, at 12:20 PM, Johan Brichau <johan at yesplan.be> wrote:

> Hi Otto,
> 
> To check if a fastcgi process is up-and-running, you can use monit [1] with the following configuration. I believe I found this online somewhere, perhaps [2].
> 
> You will want to adapt the <code to start the seaside gem> part. I just copy/pasted from our configuration and removed that command since we have specific scripts for our setup. I believe it should be something like this: "startSeaside30Adaptor FastCGI 9001".
> 
> Here is the part for monit. Just copy/paste it for each fastcgi port you are running.
> 
> check process fastcgi_9001 with pidfile /opt/gemstone/product/seaside/data/FastCGI_server-9001.pid
>        start program = "<code to start the seaside gem>" as uid sites and gid sites
>        stop program = "<code to stop the seaside gem>" as uid sites and gid sites
> 	# Empty FastCGI request 
> 	if failed port 9001 
> 		  # Send FastCGI packet: version 1 (0x01), cmd FCGI_GET_VALUES (0x09) 
> 		  # padding 8 bytes (0x08), followed by 8xNULLs padding 
> 		  send "\0x01\0x09\0x00\0x00\0x00\0x00\0x08\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00" 
> 		  # Expect FastCGI packet: version 1 (0x01), resp FCGI_GET_VALUES_RESULT (0x0A) 
> 		  expect "\0x01\0x0A" 
> 		  timeout 10 seconds 
> 	then restart
> 
> Hope this helps!
> Johan
> 
> [1] http://mmonit.com/monit/
> [2] http://richard.wallman.org.uk/2010/03/monitor-a-fastcgi-server-using-monit/
> 
> On 13 Nov 2013, at 12:18, Otto Behrens <otto at finworks.biz> wrote:
> 
>> Has anyone got some script that checks if a fast gci server is up?
> 



More information about the Glass mailing list