Koozali.org: home of the SME Server
Legacy Forums => Experienced User Forum => Topic started by: Adserg on May 01, 2003, 07:09:51 PM
-
Hi All
Question: Does anyone know of an E-smith utility which can scan an ip address and let you know when it's up or down? I simply need a utility which can ping/scan another adsl ipaddress on another site to monitor it? It would be great then if i could then get sme to mail me when the ipaddress is down.
Thanks Again
Adserg
-
I'm sure there are much more sofisticated tools than my Quick&Dirty little script, but it does the job for me. Make a cronjob for each of your hosts and you'll be rewarded with a little e-mail each time a host goes down.
Have fun
Michiel
#!/bin/sh
# Run in cron as follows:
# * * * * * /sbin/CheckHost host.name (or ip address)
Host=$1
if ! ping -c 1 -w 15 $Host >> /dev/null
then
# Host is down
if ! test -e /tmp/$Host-down ; then
echo "$Host cannot be reached since "date | mail admin -s "$Host unreachable"
echo "$Host unreachable since "date > /tmp/$Host-down
fi
else
# Host is up
if test -e /tmp/$Host-down ; then
echo "$Host is back up since "date | mail admin -s "$Host is back up!"
rm -f /tmp/$Host-down
fi
fi
-
Michiel
Thank You, i will give it ago.
I realised i had a utility called NPULSE which monitors any ip you ask it to and you can get it to e-mail to you when things go down.
At the moment a customer has had problems with his ADSL, Ive told NPULSE to monitor the ADSL and the Server's second interface. It works we have been prompted already that the line is down and prompted when it's backup.
We are able to keep a log of up and down time.
Thanks for getting back to me with your script i will try it out, Always good to try something new.
Kind Regards
Adserg