Archive for the ‘Hardware Information’ Category


Script

#!/bin/bash
H=`hostname`
cpu=`nproc`
GB=1024
echo -e “—————————————————————————————————————————-”
echo -e “\t Hardware Resource and Model”
echo -e “—————————————————————————————————————————-”
echo -e “CPU Resources Allocated = $cpu core”
M=`dmidecode -t 17 | grep -w MB | awk ‘{ SUM += $2} END { print SUM }’`
res=$(echo “scale=3;$M/$GB” | bc)
echo -e “Memory Resoruces Allocated = $res GB”
P=`dmidecode -t processor | grep -i intel | grep -i version | head -1 | cut -d’:’ -f2`
echo -e “Processor Model = $P”
TH=`fdisk -l | grep -i sd | grep -i gb |wc -l`
echo -e “Total Number Disk connected = $TH”
TSH=`fdisk -l | grep -i sd | grep -i gb | awk ‘{ SUM += $3} END { print SUM }’`
dkres=$(echo “scale=3;$TSH/$GB” |bc)
echo -e “Total Size of all Disk = $dkres TB”
NN=`lspci | grep -i ethernet | cut -d ‘:’ -f3 | head -1`
echo -e “Network Interface card Model = $NN”
TN=`lspci | grep -i ethernet | wc -l`
echo -e “Total Number of NIC Connected = $TN”
NS=`ethtool eth0 | grep -i speed |awk ‘{print $2,$3}’`
echo -e “Network Interface Speed = $NS”
echo -e “—————————————————————————————————————————-”

Output:-
[root@VM ~]# ./test.sh
————————————————————————————-
Hardware Resource and Model
————————————————————————————-
CPU Resources Allocated = 16 core
Memory Resoruces Allocated = 32.000 GB
Processor Model = Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
Total Number Disk connected = 8
Total Size of all Disk = 7.891 TB
Network Interface card Model = VMware VMXNET3 Ethernet Controller (rev 01)
Total Number of NIC Connected = 1
Network Interface Speed = 10000Mb/s
————————————————————————————-