Skip to content

Instantly share code, notes, and snippets.

@hemanth

hemanth/getNodeinfo Secret

Created May 17, 2010
Embed
What would you like to do?
#!/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
You can’t perform that action at this time.