You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jochen Kächelin <jk...@linux.amsjk.de> on 2002/10/31 02:35:41 UTC

Re[2]: [users@httpd] Testing if a Webserver is down

AST> You could ping the domain in a loop
AST> ping <IP> -t

Yes, I know, but how can I check it with a bash script?

I  pipe  the  output  of  the ping comand through grep and count the
returned lines? But I really no nothing about bash-programming!

-- 
Jochen


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Re[2]: [users@httpd] Testing if a Webserver is down

Posted by timuel <ti...@voicenet.com>.
Check these out:

http://stein.cshl.org/~lstein/talks/perl_conference/cute_tricks/sos3.html
(will restart a dead apache on localhost... very easy to customize)

AND

http://www.backhand.org/wackamole/
(will bring up an IP on one machine when it dies on another... not as easy to
customize)

--
Tim Wesemann


----- Original Message -----
From: "Jacob Coby" <jc...@listingbook.com>
To: <us...@httpd.apache.org>; <jk...@linux.amsjk.de>
Sent: Thursday, October 31, 2002 11:01 AM
Subject: Re: Re[2]: [users@httpd] Testing if a Webserver is down


| > AST> You could ping the domain in a loop
| > AST> ping <IP> -t
| >
| > Yes, I know, but how can I check it with a bash script?
| >
| > I  pipe  the  output  of  the ping comand through grep and count the
| > returned lines? But I really no nothing about bash-programming!
|
| Using ping is a bad idea, it won't give you meaningful results, unless the
| server is on fire or turned off.  I've had a webserver here go down (kernel
| panic), and it still responds to ping.
|
| Bash is really pretty easy to program for, using wget you can do:
|
| #!/bin/bash
|
| wget -t 1 -T 30 -q www.asdfjklsadfsdf.com
|
| if [ $? == 0 ]; then
|   echo 'server is up!';
| else
|   echo 'server is down!';
| fi
| ----
|
| from there, it's just a matter of plugging in your own scripts on what to do
| when the server is down :)
|
| Another option is nagios, a daemon that runs on one server and monitors
| other servers.  Comes with a web interface with nice features, and can email
| or page people responsable for bringing the downed server back up.
|
| -Jacob
|
|
| ---------------------------------------------------------------------
| The official User-To-User support forum of the Apache HTTP Server Project.
| See <URL:http://httpd.apache.org/userslist.html> for more info.
| To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
|    "   from the digest: users-digest-unsubscribe@httpd.apache.org
| For additional commands, e-mail: users-help@httpd.apache.org
|
|


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Re[2]: [users@httpd] Testing if a Webserver is down

Posted by Jacob Coby <jc...@listingbook.com>.
> AST> You could ping the domain in a loop
> AST> ping <IP> -t
>
> Yes, I know, but how can I check it with a bash script?
>
> I  pipe  the  output  of  the ping comand through grep and count the
> returned lines? But I really no nothing about bash-programming!

Using ping is a bad idea, it won't give you meaningful results, unless the
server is on fire or turned off.  I've had a webserver here go down (kernel
panic), and it still responds to ping.

Bash is really pretty easy to program for, using wget you can do:

#!/bin/bash

wget -t 1 -T 30 -q www.asdfjklsadfsdf.com

if [ $? == 0 ]; then
  echo 'server is up!';
else
  echo 'server is down!';
fi
----

from there, it's just a matter of plugging in your own scripts on what to do
when the server is down :)

Another option is nagios, a daemon that runs on one server and monitors
other servers.  Comes with a web interface with nice features, and can email
or page people responsable for bringing the downed server back up.

-Jacob


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: Re[2]: [users@httpd] Testing if a Webserver is down

Posted by Gilles Gros <gi...@whitepj.com>.
use ping -c 5 IP

man ping :

     -c count
             Stop after sending (and receiving) count packets. After the
pack-
             ets are sent, ping will wait up to ten seconds for replies to
             arrive, then exit.
Gilles


> -----Original Message-----
> From: Jochen Kächelin [mailto:jk@linux.amsjk.de]
> Sent: Wednesday, October 30, 2002 5:36 PM
> To: users@httpd.apache.org
> Subject: Re[2]: [users@httpd] Testing if a Webserver is down
>
>
> AST> You could ping the domain in a loop
> AST> ping <IP> -t
>
> Yes, I know, but how can I check it with a bash script?
>
> I  pipe  the  output  of  the ping comand through grep and count the
> returned lines? But I really no nothing about bash-programming!
>
> --
> Jochen
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org