[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [hobbit] Monitoring "internet"



This isn't particularly elegant, but something like it should do what you
want:
   #!/bin/bash

   TESTHOSTS="www.google.com www.yahoo.com www.microsoft.com"

   for N in $TESTHOSTS
   do
     curl -s -S -L -m 10 -o /dev/null http://$N
     if [ "$?" -eq "0" ]; then
       # page fetched OK
       break
     fi
     # Ran out of hosts, must be all broken
     $BB $BBDISP "status internet.web `date`
        Cannot reach any common web servers, panic now!!"
     exit 0
   done
   # found at least one working offsite server
   $BB $BBDISP "status internet.web `date`
      Found at least one working offsite server.  The world is still there."
   exit 0


Ralph Mitchell


On Wed, Aug 5, 2009 at 9:55 AM, Ricardo Stella <stella (at) rider.edu> wrote:

> Can these be combined as well? Ie do multiple http checks and go red
> only if all fail?
>
> TIA...
>
> Josh Luthman wrote:
> > Might also want to do some HTTP checks.  If your router's NAT table
> > has problems, connection limits are hit, etc.  Pretty much anything
> > TCP based but doing an HTTP request to Google should satisfy and be easy.
> >
> > Josh Luthman
> > Office: 937-552-2340
> > Direct: 937-552-2343
> > 1100 Wayne St
> > Suite 1337
> > Troy, OH 45373
> >
> > "When you have eliminated the impossible, that which remains, however
> > improbable, must be the truth."
> > --- Sir Arthur Conan Doyle
> >
> >
> > On Wed, Aug 5, 2009 at 10:10 AM, Ricardo Stella <stella (at) rider.edu
> > <mailto:stella (at) rider.edu>> wrote:
> >
> >
> >     Hello,
> >
> >     We have a request to monitor 'internet' connectivity.  (When it comes
> >     from higherups...)
> >
> >     Just pinging up the line might not be good enough as we've had issues
> >     with our providers in the recent past.  So I figured ping several
> well
> >     known hosts out in the cloud and if all are out, then we have no
> >     'internet'.
> >
> >     I came out with the following.  Seems to work, but figure I run it
> >     thru
> >     the list in case someone else has done this already...
> >
> >     page internet Internet Connectivity
> >     127.0.0.1  INTERNET # conn=ip1,ip2,ip3,ip4,ip5
> >
> >
> >     TIA...
> >
> >     To unsubscribe from the hobbit list, send an e-mail to
> >     hobbit-unsubscribe (at) hswn.dk <mailto:hobbit-unsubscribe (at) hswn.dk>
> >
> >
> >
>
>
> To unsubscribe from the hobbit list, send an e-mail to
> hobbit-unsubscribe (at) hswn.dk
>
>
>