1820890 Members
3911 Online
109628 Solutions
New Discussion юеВ

Re: multi node ping tool

 
SOLVED
Go to solution
Hubert Feller
Advisor

multi node ping tool

I am looking for a ping tool which can use a textfile containing a list of nodes and ping them all. The desired output should contain the nodes which are down as well as the nodes which cannot be resolved.
Is there something like this available?

Your help is appreciated.
6 REPLIES 6
Rainer von Bongartz
Honored Contributor

Re: multi node ping tool

You might take a look at fping from

http://www.fping.com/

Ragards
Rainer
He's a real UNIX Man, sitting in his UNIX LAN making all his UNIX plans for nobody ...
G. Vrijhoeven
Honored Contributor
Solution

Re: multi node ping tool

Hi Peter,

How about a shell script.

#!/usr/bin/ksh
for server in `cat serverlist.txt`
do
TEST=0
TEST=`nslookup $server | grep -q Address`
if [ $TEST -ne 0 ]
then
ping server -n 3 | grep loss | awk -F, '{ print $NF}' | awk -F% '{ print $1}' | grep -q " 0"
if [ $? -eq 0 ]
then echo "$server is alive, at $(date)"
fi
fi
done

HTH,

Gideon

Mark Grant
Honored Contributor

Re: multi node ping tool

You can simplify this script quite a bit

for hostname in `cat textfile`
do
output="looks fine"
ping $hostname -n 1 || output "looks broken"
echo "$hostname $output"
done
Never preceed any demonstration with anything more predictive than "watch this"
Hubert Feller
Advisor

Re: multi node ping tool

Hi all

Thank you very much for your quick help. All answers are eally valuable and I will adapt the solution to my needs an try them.

Greetings from sunny switzerland

Peter
Geoff Wild
Honored Contributor

Re: multi node ping tool

Just a thought, but you may want to check out BigBrother:

http://bb4.com/

Big Brother monitors System and Network-delivered services for availability. Your current network status is displayed on a color-coded web page in near-real time. When problems are detected, you're immediately notified by e-mail, pager, or text messaging.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Ralph Grothe
Honored Contributor

Re: multi node ping tool

Peter,

for more serious monitoring purposes of a whole server farm I'd rather stick with fping as Rainer already suggested.
fping has the great advantage of sending out Echo_Requests asynchronously.
Therefore it is better suited for monitoring.
For instance the mon utility ( http://www.kernel.org/software/mon/ ) uses fping.
fping also can read a list of hosts to ping from a file, and has an extra -f option.
Another choice would be to use the Net::Ping Perl module from CPAN.
It gives you the ability to chose from different protocols (e.g. tcp, udp, icmp) because ICMP requires root privilages, and many firewalls drop ICMP Echo Requests silently.
For the same reason are you free to select a port to ping.
Because the SSH port 22 is often not block you could ping boxes even behind firewalls.
Madness, thy name is system administration