#!/bin/sh
#
echo "1:查看服务器型号"
dmidecode | grep Product 
echo ""
#
echo "1:查看服务器序列号"
dmidecode -t 1 |grep "Serial Number"
echo ""
#
echo "2:查看CPU 型号"
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c 
echo ""
#
echo "2:查看逻辑CPU的个数"
cat /proc/cpuinfo| grep "processor"| wc -l
echo ""
#
echo "2:查看每个物理CPU中core的个数(即核数)"
cat /proc/cpuinfo| grep "cpu cores"| uniq
#
#
echo "3:查看CPU个数"
cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l  
echo ""
#
#
echo "4:查看内存个数"
dmidecode|grep -P -A5 "Memory\s+Device"|grep Size|grep -v Range |grep MB |wc -l
echo ""
#
echo "5:内存大小"
dmidecode|grep -P -A5 "Memory\s+Device"|grep Size|grep -v Range |grep MB
echo ""
#
echo "6:查看主板内存插槽个数"
dmidecode|grep -P -A5 "Memory\s+Device"|grep Size|grep -v Range |wc -l
echo ""
#
echo "7:查看内存类型"
dmidecode -t memory |grep -i ddr |head -1
echo ""
#
echo "8:是否有做raid(非LSI)"
cat /proc/mdstat
echo ""
#
echo "8:是否有做raid(LSI)"
if [ `rpm -qa |grep megacli |wc -l` == 0 ];then yum install http://220.231.201.236/data/centos/7/x86_64/megacli-5.00.20-2mdv2010.1.x86_64.rpm -y;fi
megacli -LDInfo -Lall -aALL
echo ""
#
echo "8:显示Raid卡型号，Raid设置，Disk相关信息(LSI)"
megacli -cfgdsply -aALL 
echo ""
#
echo "9:硬件raid：查看raid的厂商，型号，级别"
cat /proc/scsi/scsi |grep -i mode
echo ""
#
echo "10:查看硬盘型号"
fdisk -l |grep sd  |grep Disk
if [ `rpm -qa |grep hdparm |wc -l` == 0 ];then yum install hdparm -y;fi 
if [ `megacli -cfgdsply -aALL |grep "Product" |wc -l` == 0 ];then fdisk -l |grep sd  |grep Disk |awk -F ":" '{print "hdparm -i" $1}' |sed 's/Disk//g' |sh |grep Model |awk -F "," '{print $1}';fi
echo ""
megacli -PDlist -aALL |grep "Inquiry Data"
#
echo "11:查看系统"
cat /etc/redhat-release
echo ""
#
echo "12:查看网卡型号，可用口数"
if [ `rpm -qa |grep pciutils |wc -l` == 0 ];then yum -y install pciutils;fi
lspci -vvv |grep "Ethernet"
echo ""
#
echo "13:查看网卡速率"
dmesg  |grep -i  network |grep systemd-udevd |awk '{print "ethtool" ,$NF }'  |sh
echo ""
#
echo "13:查看网口对应的型号"
dmesg  |grep -i  network |grep systemd-udevd |awk '{print "ethtool -i" ,$NF }'  |sh
echo ""
#
echo "14:查看网卡mac地址"
dmesg  |grep -i  network |grep systemd-udevd |awk '{print "ip a" ,"|grep",$NF,"-C 1" }'  |sh
echo ""
#
echo "15:查看IPMI信息"
if [ `rpm -qa |grep ipmitool |wc -l` == 0 ];then yum install ipmitool -y;fi
ipmitool lan print
echo ""
