Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Jul 2006 17:38:58 +0200
From:      "Pietro Cerutti" <pietro.cerutti@gmail.com>
To:        "Paul Hamilton" <paulh@bdug.org.au>,  "freebsd questions" <freebsd-questions@freebsd.org>
Subject:   Re: using fping to monitor internet connection status
Message-ID:  <e572718c0607060838l148554b1h739d50c0fdfb197d@mail.gmail.com>
In-Reply-To: <032f01c6a10e$494e4c40$6600a8c0@w2k2>
References:  <032f01c6a10e$494e4c40$6600a8c0@w2k2>

next in thread | previous in thread | raw e-mail | index | archive | help
On 7/6/06, Paul Hamilton <paulh@bdug.org.au> wrote:
> Hi,

Hallo,

>
> I need to monitor a number of IP addresses, so that if they ALL go down (say
> three IP's), then that is a pretty good indication that my server has lost
> internet connectivity.
[snip]
> Any idea's on a ping tool or simple script?


#!/bin/sh
err=2 # Ping return value on error
ping -c1 host1 > /dev/null 2>&1
host1=$?
ping -c1 host2 > /dev/null 2>&1
host2=$?
ping -c3 host3 > /dev/null 2>&1
host3=$?
if [ $host1 -gt $err -a $host2 -gt $err -a $host3 -gt $err ]; then
   echo "Network is down..."
fi


Could surely be refined, but it works ;-)


> Regards,
>
> Paul Hamilton
> Busselton, 6280
> Australia
>


Regards,

-- 
Pietro Cerutti
ICQ: 117293691
PGP: 0x9571F78E

- ASCII Ribbon Campaign -
 against HTML e-mail and
 proprietary attachments
   www.asciiribbon.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e572718c0607060838l148554b1h739d50c0fdfb197d>