Shell script to ping multiple servers


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script to ping multiple servers
# 8  
Old 03-17-2017
I don't see any Invalid operation mode f in the output above...
# 9  
Old 03-18-2017
If I remove set -x I got this:
Code:
 ./netcheck.sh
Saturday, March 18, 2017 10:05:32 PM CAT
node 192.168.6.4 is up
node 192.168.6.41 is up
node 192.168.6.24 is up
node 192.168.6.11 is up
node 192.168.6.108 is up
node 192.168.6.26 is up
node 192.168.6.51 is up
node 192.168.6.8 is up
node 192.168.6.9 is up
Invalid operation mode f
node 192.168.6.25 is up
node 192.168.6.26 is up
node 192.168.6.71 is up
node 192.168.6.107 is up

# 10  
Old 03-18-2017
I think the error message is from your sendmail.
# 11  
Old 05-24-2017
RedHat

I would suggest the use of fping with the mask option, since you are not restricting yourself in ping.

This will ping all the ip in given network


Code:
fping -g 192.168.1.0/24

The response will be easy to parse in a script:

Code:
192.168.1.1 is alive
192.168.1.2 is alive
192.168.1.3 is alive
192.168.1.5 is alive
...
192.168.1.4 is unreachable
192.168.1.6 is unreachable
192.168.1.7 is unreachable
...

Note: Using the argument -a will restrict the output to reachable ip addresses, you may want to use it otherwise fping will also print unreachable addresses:

Code:
fping -a -g 192.168.1.0/24

Regards
Christian
System Admin
Cloud Hosted Virtual Desktop




Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by ChristianC123; 05-26-2017 at 04:13 PM.. Reason: Added CODE tags.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script for connecting multiple servers and then copying 30 days old files

Shell script for connecting multiple servers and then copying 30 days old files from those server . HI , I have 6 multiple servers pla1,pla2,pla3,pla4,pla5,pla6 1. These six servers have common shared mount point /var/share 2. Running script from /var/share to connect these servers.I... (1 Reply)
Discussion started by: rcroyal88
1 Replies

2. Shell Programming and Scripting

Need shell script to Telnet multiple node , Ping some IP and print output

Hi Team, Need shell script to Telnet multiple node , Ping some IP and print output like pass or fail. Need this script to check reachability of multiple nodes at same time. Help me. I use this but not working... Eg. in this script i need to telnet... (4 Replies)
Discussion started by: Ganesh Mankar
4 Replies

3. Shell Programming and Scripting

Ping script to list of servers

Hi Friends, I have experience in redhat/ Ubuntu OS, but I am very new to solaries os. my servers OS is Oracle Solaris 10 8/11 s10x_u10wos_17b X86. I have a file contains 200 servers IPs one by one. now I want a script to chaeck which IPs are pinging, not pingning. I... (8 Replies)
Discussion started by: kumar85shiv
8 Replies

4. Shell Programming and Scripting

Script to Ping Servers

Hey, It's me again! Still trying to learn to become a better scripter on the job :) New challenge for assistance, if anyone cares to help, and its two parted! First part, I wanted to create a script at work that would ping a server that was supplied in an argument, then a count (amount of times)... (5 Replies)
Discussion started by: gkelly1117
5 Replies

5. Shell Programming and Scripting

Shell script to connect to multiple ssh servers

Hello, I have access to several linux servers (mostly centos based) located in a DC in another country. from day to day I need to login to each of them to do some work (they dont have gui/window manager installed, I work only from console), or even to just do a check like df -h for disc usage.... (3 Replies)
Discussion started by: MaRiOsGR
3 Replies

6. Shell Programming and Scripting

run vi/vim encrypted shell script without decryption on multiple servers

Hello Everyone, How do we run vi/vim encrypted shell script without decryption on multiple servers. It is a simple bash script and vim -nx <filename> has been used to encrypt with desired password. Now I have few errors, the syntax is absolutely fine as I have run that script multiple times on... (0 Replies)
Discussion started by: lovesaikrishna
0 Replies

7. Shell Programming and Scripting

Ping the hostname of many servers using a script

Hi We have some 300 servers in the Data center and some of them are running with AIX and some of them are running with Solaris. I need a script which can be run in one of the server and that script should ping the hostname of all the 300 servers. Also the script should notify if any server is... (9 Replies)
Discussion started by: newtoaixos
9 Replies

8. Shell Programming and Scripting

Shell script to change the password on multiple servers in linux

Can any one please let me know the shell script to change the password for a particular user on multiple linux servers. (2 Replies)
Discussion started by: s_madras
2 Replies

9. Shell Programming and Scripting

Prevent wrong user from using shell script for multiple remote servers

Hi, I am running a shell script from a central server to multiple remote servers using the following code: application_check() { # Linux/UNIX box with ssh key based login SERVERS=`cat /tmp/server-details` # SSH User name USR="user" # create new file > /tmp/abc.log # connect... (2 Replies)
Discussion started by: mystition
2 Replies

10. UNIX for Advanced & Expert Users

script to ping servers

Hi , I would like to automate a script to ping all the unix servers perodically thru cronjob. Is there any script out there? If so Please give me. Thanks in advance. (2 Replies)
Discussion started by: sriny
2 Replies
Login or Register to Ask a Question