using fping to monitor internet connection status

Murray Taylor MTaylor at bytecraft.com.au
Fri Jul 7 02:04:25 UTC 2006


I use fping in an embedded system via a shell script that 

- 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
    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 at bytecraft.com.au 


--

"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 

 

> -----Original Message-----
> From: owner-freebsd-questions at freebsd.org 
> [mailto:owner-freebsd-questions at freebsd.org] On Behalf Of Alex Zbyslaw
> Sent: Friday, 7 July 2006 1:20 AM
> To: Paul Hamilton
> Cc: freebsd-questions at freebsd.org
> Subject: Re: using fping to monitor internet connection status
> 
> Paul Hamilton wrote:
> 
> >Hi,
> > 
> >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.  The most probable cause is 
> usually the 
> >ADSL router, and therefore needs a reboot.  I was hoping to use the 
> >'fping' program, but looking through the man file, there 
> doesn't seem 
> >to be an exit status on loosing ALL the pings.
> > 
> >If one goes down, I don't care, maybe that server is down, so keep 
> >pinging the other two etc.
> > 
> >I was hoping to write this in Perl (the first fping example 
> looked ok, 
> >until I realised that it would activate when any one IP 
> address became 
> >unreachable, which means that I am still connected to the Internet).
> > 
> >Any idea's on a ping tool or simple script?
> >  
> >
> 
> Pseudo code for perl or sh or pretty much any language that 
> can run commands and determine exit staus:
> 
>     Set a variable to 0
>     For each server
>       ping server and if it fails increment variable
>     End foreach
> 
>     If variable == number of servers then all pings failed.  
> Variable contains number of unsuccessfully pinged servers.
> 
> Or
> 
>     Set a variable to 0
>     For each server
>       ping server and if succeeds, increment variable
>     End foreach
> 
>     If variable == 0 then all pings failed.  Variable 
> contains number of successfully pinged servers.
> 
>  From sh "ping -c 1 -q host > /dev/null 2>&1" will ping host 
> and set status with no actual output.
> 
> Never heard of fping.
> 
> --Alex
> 
> 
> _______________________________________________
> freebsd-questions at freebsd.org mailing list 
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to 
> "freebsd-questions-unsubscribe at freebsd.org"
> 
> ***This Email has been scanned for Viruses by MailMarshal.***
> 
---------------------------------------------------------------
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. 

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.***


More information about the freebsd-questions mailing list