Sharing Basic script which I have shared in Some LUG before few months.
Sharing it here because it will help to people who wants to check PING of Bulk IP Addresses and check status and health by pinging the IP Address.
Again repeating this is very basic script and many changes required to improve, You can suggest me or you can send me improve one so i will update it over here. Your Suggestions are always welcome.
Requirements to run Script :-
1. One File which contains all IPs. One IP per line.
2. If you have different class, From system which you are running this script must contact those hosts. Routing must be through to get ping.
# Below is example file. which is containing IP List
[root@tejas-barot-lenovo ~]# cat /root/ping.txt
#Below is script which will helps you. Script is not dynamic with variable and all
[root@tejas-barot-lenovo ~]# cat /root/ping.sh
####### Script Starts from here ######
# -c3 = is ping count, It will ping for 3 times, You can increase or decrease this number.
for PNG in $(cat /root/ping.txt)
ping -c3 $PNG > /dev/null 2>&1
if [ $VAL = 0 ] ; then
echo “Success Ping… Host $PNG is up”
echo “No Ping…Host $PNG is Down”
##### Script Ends here ##
You can also you fping :
As Normal User, fping will not allow you to specify -f, -f is allowed for root only.
As a Normal user you can try, even as root you can try following :-
$ fping < <file-name-with-ips>
# fping < <file-name-with-ips>
Hope this will helps you.
Enjoy Linux 🙂 Enjoy Scripting 🙂 Enjoy Open Source 🙂