[SATLUG] program or cron job to ping internal devices & email

twistedpickles twistedpickles at gmail.com
Wed Jan 16 06:29:03 CST 2008


Thanks but I dont't think that will work because an unsuccessful ping also returns or displays info and when piped will also be gt than 0kb

twistedpickles 

//Message sent from mobile handset 

-----Original Message-----
From: "Geoff" <geoff at w5omr.shacknet.nu>
To: "The San Antonio Linux User's Group Mailing List" <satlug at satlug.org>
Sent: 1/16/08 5:15 AM
Subject: Re: [SATLUG] program or cron job to ping internal devices & email

twistedpickles wrote:
> Does know or have a program or cron job that can ping network devices and if
> down send out an email?

Well, ping returns a result, right?  if it doesn't you could do a number
of things.

One that comes to mind, is to ping whatever you want, for a specified
amount of pings, pipe that info to a file then have the cron exit with
an error level, check the file size and it's other than 0b, don't send a
message.

Of course, you'd probably want to ping whoever for about 15 or 20
responses so that there's significant data in the text file you've piped
your ping information to.

just as an example...

I got a return of

 :> ls -la ping.txt
-rw-r--r-- 1 geoff users 1007 2008-01-16 05:12 ping.txt

when I did
:> ping -c10 w5omr.shacknet.nu >ping.txt

so, you could write a simple little script file to call ping, pipe the
output to a file, check if the filesize is greater than 0bytes and if
not, send a message.

Clear as mud?

 ;-)

--
Geoff

-- 
_______________________________________________
SATLUG mailing list
SATLUG at satlug.org
http://alamo.satlug.org/mailman/listinfo/satlug to unsubscribe
Powered by Rackspace (www.rackspace.com)



More information about the SATLUG mailing list