Skip to content

Instantly share code, notes, and snippets.

@hemanth
Created May 17, 2010 05:50
Show Gist options
  • Save hemanth/24760a1d2066e02ed0a8 to your computer and use it in GitHub Desktop.
Save hemanth/24760a1d2066e02ed0a8 to your computer and use it in GitHub Desktop.
#!/bin/bash
user=root
getNodeinfo()
{
#Get the ip address for the range
ip=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' | cut -d"." -f1,2,3)
# ping test and list the hosts and echo the info
for range in $ip ; do ping -c 1 -w 1 $ip > /dev/null 2> /dev/null >> /tmp/pinglog &&[ $? -eq 0 ] && echo "Node $range is up" && echo "More info about the machine" ; echo "Kernel:$(ssh $user@$range cat /proc/version)" && echo "CPU info:$(ssh $user@$range cat /proc/cpuinfo )" && echo "Mem info:$(ssh $user@$range cat /proc/meminfo)" && echo "Release:$(ssh $user@$range lsb_release -a)"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment