From owner-freebsd-questions@FreeBSD.ORG Fri Jul 7 02:04:25 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 33B8216A4E2 for ; Fri, 7 Jul 2006 02:04:25 +0000 (UTC) (envelope-from MTaylor@bytecraft.com.au) Received: from wolf.bytecraft.au.com (wolf.bytecraft.au.com [203.39.118.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0993143D5A for ; Fri, 7 Jul 2006 02:04:16 +0000 (GMT) (envelope-from MTaylor@bytecraft.com.au) Received: from localhost (localhost [127.0.0.1]) by wolf.bytecraft.au.com (8.12.11/8.12.11) with ESMTP id k67241Fa035989; Fri, 7 Jul 2006 12:04:01 +1000 (EST) (envelope-from MTaylor@bytecraft.com.au) Received: from wolf.bytecraft.au.com ([127.0.0.1]) by localhost (wolf.bytecraft.au.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 35881-01; Fri, 7 Jul 2006 02:04:00 +0000 (GMT) Received: from svmarshal.bytecraft.au.com ([10.0.0.4]) by wolf.bytecraft.au.com (8.12.11/8.12.11) with ESMTP id k67238N5035973; Fri, 7 Jul 2006 12:03:10 +1000 (EST) (envelope-from MTaylor@bytecraft.com.au) Received: from svmailmel.bytecraft.internal (Not Verified[10.0.0.24]) by svmarshal.bytecraft.au.com with MailMarshal (v5, 0, 3, 78) id ; Fri, 07 Jul 2006 12:03:08 +1000 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Date: Fri, 7 Jul 2006 12:03:07 +1000 Message-ID: <04E232FDCD9FBE43857F7066CAD3C0F117D43F@svmailmel.bytecraft.internal> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: using fping to monitor internet connection status Thread-Index: AcahD75JXEAWAZAFTRWzfHCA84GA5wAWQ/Ig From: "Murray Taylor" To: "Alex Zbyslaw" , "Paul Hamilton" Cc: freebsd-questions@freebsd.org Subject: RE: using fping to monitor internet connection status X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jul 2006 02:04:25 -0000 I use fping in an embedded system via a shell script that=20 - pings a user settable list of hosts - records 'presence/absence' of a host - determines changes from the previous cycle - notifies me via a SMS sender with a 'human readable' message =20 derived from the hosts list (ie "Level 3 east switch is missing") NB I also listen for SNMP traps from appropriately cabable devices Fping is in ports /usr/ports/net/fping Murray Taylor Special Projects Engineer Bytecraft Systems P: +61 3 8710 2555 F: +61 3 8710 2599 D: +61 3 9238 4275 E: mtaylor@bytecraft.com.au=20 -- "Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction." --Albert Einstein=20 =20 > -----Original Message----- > From: owner-freebsd-questions@freebsd.org=20 > [mailto:owner-freebsd-questions@freebsd.org] On Behalf Of Alex Zbyslaw > Sent: Friday, 7 July 2006 1:20 AM > To: Paul Hamilton > Cc: freebsd-questions@freebsd.org > Subject: Re: using fping to monitor internet connection status >=20 > Paul Hamilton wrote: >=20 > >Hi, > >=20 > >I need to monitor a number of IP addresses, so that if they=20 > ALL go down=20 > >(say three IP's), then that is a pretty good indication that=20 > my server=20 > >has lost internet connectivity. The most probable cause is=20 > usually the=20 > >ADSL router, and therefore needs a reboot. I was hoping to use the=20 > >'fping' program, but looking through the man file, there=20 > doesn't seem=20 > >to be an exit status on loosing ALL the pings. > >=20 > >If one goes down, I don't care, maybe that server is down, so keep=20 > >pinging the other two etc. > >=20 > >I was hoping to write this in Perl (the first fping example=20 > looked ok,=20 > >until I realised that it would activate when any one IP=20 > address became=20 > >unreachable, which means that I am still connected to the Internet). > >=20 > >Any idea's on a ping tool or simple script? > > =20 > > >=20 > Pseudo code for perl or sh or pretty much any language that=20 > can run commands and determine exit staus: >=20 > Set a variable to 0 > For each server > ping server and if it fails increment variable > End foreach >=20 > If variable =3D=3D number of servers then all pings failed. =20 > Variable contains number of unsuccessfully pinged servers. >=20 > Or >=20 > Set a variable to 0 > For each server > ping server and if succeeds, increment variable > End foreach >=20 > If variable =3D=3D 0 then all pings failed. Variable=20 > contains number of successfully pinged servers. >=20 > From sh "ping -c 1 -q host > /dev/null 2>&1" will ping host=20 > and set status with no actual output. >=20 > Never heard of fping. >=20 > --Alex >=20 >=20 > _______________________________________________ > freebsd-questions@freebsd.org mailing list=20 > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to=20 > "freebsd-questions-unsubscribe@freebsd.org" >=20 > ***This Email has been scanned for Viruses by MailMarshal.*** >=20 --------------------------------------------------------------- The information transmitted in this e-mail is for the exclusive use of the intended addressee and may contain confidential and/or privileged material. Any review, re-transmission, dissemination or other use of it, or the taking of any action in reliance upon this information by persons and/or entities other than the intended recipient is prohibited. If you received this in error, please inform the sender and/or addressee immediately and delete the material.=20 E-mails may not be secure, may contain computer viruses and may be corrupted in transmission. Please carefully check this e-mail (and any attachment) accordingly. No warranties are given and no liability is accepted for any loss or damage caused by such matters. --------------------------------------------------------------- ***This Email has been scanned for Viruses by MailMarshal.***