SUMMARY: Simple "ping" script

From: Mike's List <mikelist_at_sky.net>
Date: Fri Jan 17 2003 - 10:59:57 EST
Below are some of the basic/shorter scripts, this is exactly what I needed.
Note, ping is not a very sufficient way to monitor your network, but for
what I'm doing/monitoring, it's sufficient.

Thanks all.


- Mike


Alex
----
#!/bin/sh

ping foo

if [ $? != 0 ]
then
        mailx -s "foo is dead." 1234567890@somepager.com <EOF
Unable to ping foo.
EOF
fi

Michael M
---------
#!/bin/sh
    ping somemachine > /dev/null 2>&1
    if [ $? = 1 ] ; then
        mailx -s "Ping failed" 1234@somepager.com < /tmp/somemessage
    fi

Michael S
---------
#!/bin/csh
/usr/sbin/ping <host> <wait-time>
if ($status != 0) then
   /usr/bin/mailx 1234567890@somepager.com
endif

Reggie
------
#!/bin/sh
# quick-n-dirty
# send mail if ping fails after 3 seconds
#
/usr/sbin/ping $1 3 >/dev/null 2>&1
if [ ! "$?" -eq 0 ]; then
echo "ping $1 failed"|
/usr/bin/mailx -s "ping $1 failed" 1234567890@somepager.com
fi

wave++
------
ping -q "$1" >/dev/null 2>&1
if [ "$?" != "0" ]; then
        cat << EOF | mailx -s "AARGH! $1 is DOWN!!" $2
This machine: $1 is down!!!!
Local time: `date`

EOF
fi


---------- original message ----------

Anyone has a script, sample cron job, or know of a web site w/download
scripts that do the following: (need for Solaris 8, not any other OS)

ping a host, if host alive --do nothing, if host not respond --send
an e-mail to pager 1234567890@somepager.com w/a short text message.
(of course the script is run on a machine that's alive in the first
place and able to send mail).

I'm not looking for a complex program or script/cgi (ie. Mon Program,
http://www.kernel.org/software/mon/) something more simple (like above).

Thanks.


- Mike
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Fri Jan 17 11:05:34 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:01 EST