Timeouts / server down

From: Neil . (neil171@hotmail.com)
Date: Tue Oct 29 2002 - 21:48:35 CET

Greetings to the Pen list !

I experienced timeout issues a while back when for example an httpd server
was not just not accepting connection, but was down ( switched off or dead

I realize than pen doesnt handle this , and after Ulrich told me this i made
a script that checks httpd and sends a pentctl command to blacklist this
particular box , fine , its extra work , but not rocket science.

In my script i use wget to check for 200 OK , but wget hangs around for 3 or
4 minutes too when the ip is not respsonding, just like pen !

There must be something fundamental here i dont understand , but how can i
work around this ? I need to know with say 20 seconds if a machine has died
and block it with penctl.

Does anyone have an idea why this takes so long to time out ?

Heres a demo of my script , and the the source to it ..

Thanks in advance

Neil M

root@lx001 root]# date ; ./check_httpd.sh ; date
Tue Oct 29 21:26:08 CET 2002
httpd down on , blocking on penctl for 10
Tue Oct 29 21:29:33 CET 2002


[root@lx001 root]# cat check_httpd.sh

if [[ "X$1" == "X" ]] ; then
        echo "needs an IP as an argument.."

http=`wget --timeout=5 -O - 2>&1 http://"$1" | grep OK |wc -l`

if [[ $http -ne 1 ]] ; then
        echo "httpd down on $1 , blocking $1 on penctl for 10 minutes"
        /usr/local/bin/penctl -b 0 600

Surf the Web without missing calls! Get MSN Broadband.

This archive was generated by hypermail 2.1.2 : Tue Oct 29 2002 - 22:19:44 CET