檢視伺服器硬體配置資訊
本次由於需要搭建一套環境,但是所需硬體配置不足,需要進行統計採購。那麼就需要得知伺服器現有配置,所以這次會介紹些常用的命令和工具來查詢硬體資訊。其實也可以通過像DELL廠商的IDRAC控制檯來獲取這些資訊,但是比較尷尬的是IBM在獲取硬碟資訊方面支援比較差,僅顯示物理磁碟數量,能夠獲取的資訊很少,這時就需要像storcli這種專業工具來收集。本章使用的命令查詢需求比較單一,後續會在實際使用中慢慢補充上來。
一、檢視伺服器對應 IPMI 地址
[[email protected] ~]# ipmitool lan print
Set in Progress : Set Complete Auth Type Support : NONE MD2 MD5 PASSWORD Auth Type Enable : Callback : : User : MD2 MD5 PASSWORD : Operator : MD2 MD5 PASSWORD : Admin : MD2 MD5 PASSWORD : OEM : IP Address Source : Static Address IP Address : 10.100.0.40 Subnet Mask : 255.255.255.0 MAC Address : 40:f2:e9:da:53:fe SNMP Community String : public IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10 BMC ARP Control : ARP Responses Enabled, Gratuitous ARP Disabled Gratituous ARP Intrvl : 2.0 seconds Default Gateway IP : 10.100.0.1 Default Gateway MAC : 00:00:00:00:00:00 Backup Gateway IP : 0.0.0.0 Backup Gateway MAC : 00:00:00:00:00:00 802.1q VLAN ID : Disabled 802.1q VLAN Priority : 0 RMCP+ Cipher Suites : 1,2,3,4,5,6,7,8,9,10,11,12,13,14 Cipher Suite Priv Max : aaaaaaaaaaaaaaX : X=Cipher Suite Unused : c=CALLBACK : u=USER : o=OPERATOR : a=ADMIN : O=OEM
二、檢視網絡卡速率
[[email protected] ~]# lspci | grep Ethernet #列出每個pci總線上的裝置,通過grep過濾可得到網絡卡裝置列表,這裡看到總計8個網絡卡
06:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01) 06:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01) 06:00.2 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01) 06:00.3 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01) 11:00.0 Ethernet controller: Broadcom Limited NetXtreme II BCM57810 10 Gigabit Ethernet (rev 10) 11:00.1 Ethernet controller: Broadcom Limited NetXtreme II BCM57810 10 Gigabit Ethernet (rev 10) 20:00.0 Ethernet controller: Broadcom Limited NetXtreme II BCM57810 10 Gigabit Ethernet (rev 10) 20:00.1 Ethernet controller: Broadcom Limited NetXtreme II BCM57810 10 Gigabit Ethernet (rev 10)
[[email protected] ~]# ethtool eth0 #檢視單塊網絡卡的詳細資訊
Settings for eth0: Supported ports: [ TP ] #TP 代表是千兆網絡卡 Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: Symmetric Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: Symmetric Advertised auto-negotiation: Yes Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 1 Transceiver: internal Auto-negotiation: on MDI-X: on (auto) Supports Wake-on: pumbg Wake-on: g Current message level: 0x00000007 (7) drv probe link Link detected: yes
[[email protected] ~]# ethtool eth1
Settings for eth1:
Supported ports: [ FIBRE ] #FIBRE 代表是萬兆網絡卡
Supported link modes: 1000baseT/Full
10000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: No
Advertised link modes: 10000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: No
Speed: Unknown!
Duplex: Unknown! (255)
Port: FIBRE
PHYAD: 1
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: g
Wake-on: d
Current message level: 0x00000000 (0)
Link detected: no
三、檢視記憶體資訊
[[email protected] ~]# cat /proc/meminfo
[[email protected] ~]# dmidecode -t memory #此命令會列出每條記憶體的型號、頻率等詳細資訊
Handle 0x000A, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x0009
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 8192 MB
Form Factor: DIMM
Set: 1
Locator: DIMM 1
Bank Locator: Bank 1
Type: DDR3
Type Detail: Registered (Buffered)
Speed: 1333 MHz
Manufacturer: Samsung
Serial Number: 3386DA95
Asset Tag: Unknown
Part Number: M393B1K70DH0-YH9
Rank: 2
Configured Clock Speed: 1333 MHz
四、使用 storcli 檢視伺服器硬體基礎資訊
[[email protected] ~]# rpm -ivh storcli-1.18.05-1.noarch.rpm #安裝包請見文章末尾
[[email protected] ~]# /opt/MegaRAID/storcli/storcli64 show all #查詢所有資訊並show,在system overview下看到controller(縮寫ctl)列數字就是controller號,得知node-1這臺機器的controller號是0
System Overview :
===============
---------------------------------------------------------------------------
Ctl Model Ports PDs DGs DNOpt VDs VNOpt BBU sPR DS EHS ASOs Hlth
---------------------------------------------------------------------------
0 ServeRAIDM5110e 8 7 5 0 5 0 Opt On - Y 3 Opt
---------------------------------------------------------------------------
[[email protected] ~]# /opt/MegaRAID/storcli/storcli64 /c0 show #顯示contrller0的raid卡的版本、功能、狀態、以及raid卡下的物理磁、邏輯盤資訊,這裡我需要看物理磁碟的容量情況,可以在PD LIST部分找到
如果不需要其他資訊,和我一樣只需要知道物理磁碟資訊的話可以使用如下命令
[[email protected] ~]# /opt/MegaRAID/storcli/storcli64 /c0/eall/sall show
Controller = 0
Status = Success
Description = Show Drive Information Succeeded.
Drive Information :
=================
-------------------------------------------------------------------------
EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp
-------------------------------------------------------------------------
252:0 20 Onln 1 278.464 GB SAS HDD N N 512B MK3001GRRB U
252:1 15 Onln 1 278.464 GB SAS HDD N N 512B ST9300603SS F U
252:2 16 Onln 0 557.861 GB SAS HDD N N 512B MBF2600RC U
252:3 17 Onln 0 557.861 GB SAS HDD N N 512B MBF2600RC U
252:4 19 Onln 2 557.861 GB SAS HDD N N 512B MBF2600RC U
252:5 14 Onln 3 557.861 GB SAS HDD N N 512B MBF2600RC U
252:6 18 Onln 4 557.861 GB SAS HDD N N 512B MBF2600RC U
-------------------------------------------------------------------------
五、不想安裝 storcli 的情況下檢視硬碟型號資訊
[[email protected] ~]# cat /proc/scsi/scsi|grep 'Model:' #node-1 是 IBM X3650 M4
Vendor: IBM Model: ServeRAID M5110e Rev: 3.34
Vendor: IBM Model: ServeRAID M5110e Rev: 3.34
Vendor: IBM Model: ServeRAID M5110e Rev: 3.34
Vendor: IBM Model: ServeRAID M5110e Rev: 3.34
Vendor: IBM Model: ServeRAID M5110e Rev: 3.34
Vendor: IBM SATA Model: DEVICE 81Y3682 Rev: D001
[[email protected] ~]# cat /proc/scsi/scsi|grep 'Model:' #node-5 是 DELL R720,ST1000NM0023就是硬碟的型號
Vendor: SEAGATE Model: ST1000NM0023 Rev: GS0D
Vendor: SEAGATE Model: ST1000NM0023 Rev: GS0D
Vendor: SEAGATE Model: ST1000NM0023 Rev: GS0F
Vendor: SEAGATE Model: ST1000NM0023 Rev: GS0D
這種方式在硬碟做 raid 後不便於檢視,例如下面檢視我另一臺伺服器所看到到的,顯示只有一塊磁碟裝置
[[email protected] ~]# cat /proc/scsi/scsi|grep 'Model:'
Vendor: DELL Model: PERC H710 Rev: 3.13
Vendor: TSSTcorp Model: DVD-ROM SN-108FB Rev: D150
接下來通過 lsblk 檢視裝置情況,發現這塊盤總容量2.7T(我這裡使用的盤是1T的SAS盤,可以倒推出是4塊1T盤組成的raid5)正好對應上我在IDRAC介面中看到的四塊物理磁碟
[[email protected] ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 2.7T 0 disk
├─sda1 8:1 0 24M 0 part
├─sda2 8:2 0 200M 0 part
├─sda3 8:3 0 250M 0 part /boot
├─sda4 8:4 0 1.4T 0 part
│ ├─os-root 253:0 0 1.4T 0 lvm /
│ └─os-swap 253:1 0 32G 0 lvm [SWAP]
└─sda5 8:5 0 1.3T 0 part
└─mongo-mongodb 253:2 0 1.3T 0 lvm /var/lib/mongo
sr0 11:0 1 1024M 0 rom
storcli安裝包各平臺百度網盤連結地址(資源來自https://blog.csdn.net/baidu_25506889/article/details/48292603)
連結:https://pan.baidu.com/s/1hbmLeFB6TJGOMa-lcK6zSg
提取碼:cg48