Date: Fri, 7 Jul 2006 12:03:07 +1000 From: "Murray Taylor" <MTaylor@bytecraft.com.au> To: "Alex Zbyslaw" <xfb52@dial.pipex.com>, "Paul Hamilton" <paulh@bdug.org.au> Cc: freebsd-questions@freebsd.org Subject: RE: using fping to monitor internet connection status Message-ID: <04E232FDCD9FBE43857F7066CAD3C0F117D43F@svmailmel.bytecraft.internal>
next in thread | raw e-mail | index | archive | help
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.***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?04E232FDCD9FBE43857F7066CAD3C0F117D43F>