[LearnAdmin] Get CPU RAM MEMORY of all the servers on the network

12 views
Skip to first unread message

Naresh Surampudi

unread,
Apr 26, 2013, 2:25:52 AM4/26/13
to learnadmin+g...@googlegroups.com

In order to accomplish this you have to have an account with password less lo-gins for all the server on the network you want to retrieve data

Here is my tutorial for password less login

Create a file "ips" which should contain all the ip's you want to retrive data for ( 1 ip per line )


for i in `cat ips`;do ssh -t $i 'echo -e -n `uname -n `"   '$i' " ;cat /proc/cpuinfo | grep "cpu cores" | uniq';done > cpucores

( This one will not work in single core cpu's or vm's )

for i in `cat ips`;do ssh -t $i 'echo -e -n `uname -n `"   '$i'" ;grep MemTotal /proc/meminfo   ';done > Mem_details


for i in `cat ips`;do ssh -t $i 'echo -e -n `uname -n `"   '$i'  " ; sudo /sbin/fdisk -l | grep Disk ';done >hdd_details 

( This one will not work in single core cup's or vm's )

After you run all the three commands you will have three files in your directory

1) cpucores - list servername ip-address and number of cores
2) Mem_details - list servername ip-address and memory details in kb
3) hdd_details - list servername ip-address and drive and size.



--
Posted By Naresh Surampudi to LearnAdmin at 4/26/2013 11:55:00 AM
Reply all
Reply to author
Forward
0 new messages