PHPBuilder - Check Nodes

RSS Twitter

Check Nodes

by: Jason Chambers
March 30, 2002

Version: v1.1

Type: Full Script

Category: Networking

License: GNU General Public License

Description: php page that runs a bash script to check for responses from a list of hosts/nodes bash script included ;)

# accecpts a file as a list of nodes to ping to check for responses


# reads the file and for each item in the file, tries 
# to ping it, if it gets a response awk $7 (which is 
# % of packet loss) determines if the node is OK or 
# got No Response

for i in $( /bin/cat $myList ); 
	echo $i ;
	ping $i -n -c 1 -w 1 | grep packet | awk '$7 == "0%" {print " OK"}
;$7 =="100%" {print "   ...Did Not Respond!"}' 

# make sure your 'ping' line is only one(1) line
# funny how there is more comments in here then code, hey?
# ;)

Comment and Contribute

Your comment has been submitted and is pending approval.

Jason Chambers



(Maximum characters: 1200). You have characters left.