Linux |
AIX |
|
---|---|---|
Number of Processors | Number of Physical CPU sockets # cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l Number of Cores # cat /proc/cpuinfo | egrep "core id|physical id" | tr -d "\n" | sed s/physical/\\nphysical/g | grep -v ^$ | sort | uniq | wc -l Total number of hyperthreads # cat /proc/cpuinfo | grep processor | wc -l |
prtconf | grep "Number of Processors" |
Processor Type | cat /proc/cpuinfo | grep "model name" | uniq |
prtconf | grep "Processor Type" |
Processor Clock Speed | cat /proc/cpuinfo | grep "model name" | uniq | prtconf | grep "Processor Clock Speed" |
Disk information | fdisk -l | lspv |
Network Card | lspci | grep Ethernet |
#lsdev -Cc if # lsdev -Cc adapter # entstat -d en0 |
Memory | cat /proc/meminfo | grep MemTotal | prtconf | grep "Memory Size" |
IP Address | hostname -i | prtconf | grep "IP Address" |
HBA | lspci | grep HBA |
lsdev -Cc adapter | grep "FC Adapter" |
A simple PERL script that will give system and OS information on a Linux box
#!/usr/bin/perl -w # # A simple PERL script that gives system information like Linux kernel version # CPU, Memory, IP address, and HBA # # # Function that returns Linux kernel information # sub os { open (MYOS, "uname -a|"); while (<MYOS>) { $my_os = $_; chomp($my_os); @kernel_version = split(/\s+/, $my_os); print "OS Version: $kernel_version[0] $kernel_version[2]\n"; } close (MYOS); } # # Function that returns the RedHat release information # sub rhat { open (MYRH, "cat /etc/redhat-release|"); while (<MYRH>) { $my_rh = $_; chomp($my_rh); print "RedHat Release Version: $my_rh\n\n"; } close (MYRH); } # # Function that returns number of CPU sockets on the machine # sub numcpu { open (MYPROC, "cat /proc/cpuinfo | grep \"physical id\" | sort | uniq | wc -l |"); while (<MYPROC>) { $num_cpu = $_; chomp($num_cpu); print "Number of CPU/Sockets: $num_cpu\n\n"; } close (MYPROC); } # # Function that returns the number of hardware threads in the processor # sub numhwthreads { open (MYHWTHREADS, "cat /proc/cpuinfo | grep processor | wc -l |"); while (<MYHWTHREADS>) { $num_threads = $_; chomp($num_threads); print "Number of Hardware threads: $num_threads\n\n"; } close (MYHWTHREADS); } # # Function that returns the processor type. # sub proctype { open (MYPROCTYPE, "cat /proc/cpuinfo | grep \"model name\" | uniq |"); while (<MYPROCTYPE>) { $num_cpu = $_; chomp($num_cpu); @proc_info = split(/:/,$num_cpu); print "Processor Type: $proc_info[1]\n\n"; } close (MYPROCTYPE); } # # Function that returns the Memory information # sub memory { open (MYMEMORY, "cat /proc/meminfo | grep MemTotal |"); while (<MYMEMORY>) { $my_memory = $_; chomp($my_memory); @memory_kb = split(/\s+/,$my_memory); $memory_gb = $memory_kb[1]/1048576; print "Memeory: $memory_gb GB\n\n"; } close (MYMEMORY); } # # Function that returns the IP address of the host # sub ipaddress { open (MYIP, "hostname -i |"); while (<MYIP>) { $my_ip = $_; chomp($my_ip); print "IP address: $my_ip\n\n"; } close (MYMEMORY); } # # Function that returns the HBA information on the host # sub hba { open (MYHBA, "lspci | grep HBA|"); while (<MYHBA>) { $my_hba = $_; chomp($my_hba); print "HBA: $my_hba\n"; } close (MYHBA); } os(); rhat(); numcpu(); numhwthreads(); proctype(); memory(); ipaddress(); hba(); |
No comments:
Post a Comment