- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ping server
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2006 04:44 PM
11-22-2006 04:44 PM
I have 5 servers. I need a script that can ping to all the 5 server and if it failed to respond, an sms alert will be sent to me.
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2006 05:24 PM
11-22-2006 05:24 PM
SolutionHere is the script for pingcheck,
########################################
RESULT=`ping server1 -n 3 | grep transmitted | awk '{print $7}'`
if [ $RESULT = "0%" ]
then
tput bold ; echo " server1 is ALIVE " ; tput rmso
else
echo " server1 is NOT REACHABLE !!!! "
fi
########################################
* You can add multiple server entry by calling through a server list file.
Cheers,
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2006 05:33 PM
11-22-2006 05:33 PM
Re: ping server
Here is the full script that will help to check the all servers for ping,
You need :
1) server.list [ server names file ]
2) pingcheck.sh [ The below script ]
------------------
####################################
# Script pingcheck.sh
# Ver 1.01 (Raj.D)
# Check all servers if alive or down.
#####################################
for i in `cat server.list`
do
echo $i
RESULT=`ping $i -n 2 | grep transmitted | awk '{print $7}'`
if [ $RESULT = "0%" ]
then
tput bold ; echo "$i is ALIVE " ; tput rmso
else
tput smso ; echo "$i is NOT REACHABLE !!!! " ; tput rmso
fi
done
##########################################
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2006 05:38 PM
11-22-2006 05:38 PM
Re: ping server
HTH,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2006 07:29 PM
11-22-2006 07:29 PM
Re: ping server
Great script. How can I send an sms alert if the server is not reachable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2006 08:20 PM
11-22-2006 08:20 PM
Re: ping server
You need to add the mailx command after else statement and before fi.
ex:
echo " $i is unreachable" | mailx -s "$i is unreachable" yourcell@domain.com
cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2006 08:21 PM
11-22-2006 08:21 PM
Re: ping server
Thank you.