注:适用于超微x86_64主板,已测阿里龙蜥8.4,华为欧拉20.03,centos7,centos8,细节部分根据自己实际情况调整
[root@test ~]# cat TheServer_test_supermicro_x86_64.sh Baseboard_info=$(dmidecode 2>/dev/null | egrep -iA9 'Base Board Information|System Information' | grep -i Manufacturer|sort |uniq| awk -F: '{print $2}') Baseboard_name=$(dmidecode 2>/dev/null | egrep -iA9 'Base Board Information|System Information' | grep -i 'Product Name'|sort |uniq| awk -F: '{print $2}') Cpu_info=$(lscpu |grep '^Model name' |cut -d: -f2|sed 's/^ *//') Cpu_num=$(cat /proc/cpuinfo|grep 'physical id'|sort|uniq|wc -l) Memory_info=$(dmidecode -t memory|grep 'Volatile Size'|egrep -v 'No Module Installed|None') Memory_num=$(dmidecode -t memory|grep 'Volatile Size'|egrep -v 'No Module Installed|None'|wc -l) MegaRAID_info=$(storcli /c0 show | grep MegaRAID|awk -F'Mega' '{print $2}') QLogic_info=$(lspci -vv 2> /dev/null | grep QLE) Ethernet_info=$(lspci -vv 2> /dev/null|grep Ethernet) Disk_info=$(storcli /call/eall/sall show | grep -A100 -B1 'EID:Slt' | egrep -v '^$|=') RAID_cfg=$(storcli /c0 show | grep -A100 TOP|grep -B100 'VD LIST'|grep -vE '^$|=|LIST|TOP') RAID_FW=$(storcli /c0 show | grep 'FW Version' | awk -F= '{print $NF}') Qlogic_FW=$(qaucli -pr fc -i all|egrep 'Flash Firmware Version|Running Firmware Version') Ethernet_FW=$(net_card=$(ip a|awk -F ': ' '{print $2}'|grep ^e);for i in $net_card;do echo "${i}的firmware-version:";ethtool -i $i|awk -F ": " '/^firmware/{print $2}' ;done) sys_info=$(uname -r;cat /etc/system-release /etc/redhat-release 2>/dev/null|sort|uniq) bios_version=$(dmidecode -s bios-version) bios_info=$(dmidecode -t bios|egrep -v '^$|^#') memory_info_add=$(dmidecode -t memory|egrep 'Locator|Configured Memory Speed:|Manufacturer:|Memory Technology:|Volatile Size:'|egrep -v 'Unknown|None|Node') CPU_info_add=$(lscpu |egrep '^Architecture:|^CPU\(s\):|^On-line CPU\(s\) list:') IPMI=$(ipmitool lan print |grep '^IP Address')
echo "
主板厂商: $Baseboard_info 主板型号: $Baseboard_name
系统信息: $sys_info bios版本:$bios_version CPU型号: $Cpu_info cpu数量: $Cpu_num cpu其他信息: $CPU_info_add 内存: $Memory_info 内存条数量: $Memory_num 其他内存信息: $memory_info_add RAID卡:$MegaRAID_info RAID卡FW: $RAID_FW RAID组: $RAID_cfg 光纤卡: $QLogic_info 光纤卡FW: $Qlogic_FW 网卡: $Ethernet_info 网卡FW: $Ethernet_FW 硬盘: $Disk_info IPMI地址: $IPMI "
标签:info,grep,FW,出厂,dmidecode,linux,print,egrep,抓包 From: https://www.cnblogs.com/santia-god/p/16938144.html