運維管理利器系列--ipmitool


介紹

IPMItool用於訪問IPMI的功能-智能平台管理接口,該系統接口管理和監視帶外計算機系統。它是一個命令提示符,用於控制和配置IPMI支持的設備。

在本教程中,學習如何在基於Linux的CentOS或Ubuntu系統上安裝IPMItool並開始使用IPMI命令。

1:通過系統查看物理機帶外管理IP

[root@localhost tmp]# ipmitool lan print 1
Set in Progress         : Set Complete
Auth Type Support       : MD5
Auth Type Enable        : Callback : MD5
                        : User     : MD5
                        : Operator : MD5
                        : Admin    : MD5
                        : OEM      : MD5
IP Address Source       : Static Address
IP Address              : 192.168.206.57
Subnet Mask             : 255.255.255.0
MAC Address             : 6c:92:bf:9b:4c:49
SNMP Community String   : AMI
IP Header               : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10
BMC ARP Control         : ARP Responses Enabled, Gratuitous ARP Disabled
Gratituous ARP Intrvl   : 0.0 seconds
Default Gateway IP      : 192.168.206.1
Default Gateway MAC     : 58:60:5f:87:2e:c3
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     : 0,1,2,3,6,7,8,11,12,15,16,17
Cipher Suite Priv Max   : caaaaaaaaaaaXXX
                        :     X=Cipher Suite Unused
                        :     c=CALLBACK
                        :     u=USER
                        :     o=OPERATOR
                        :     a=ADMIN
                        :     O=OEM
Bad Password Threshold  : 0
Invalid password disable: no
Attempt Count Reset Int.: 0
User Lockout Interval   : 0

2:查詢BMC中相關的SDR(傳感器數據記錄)信息

[root@k8s-node-gpu-dataswitch-p-222028 yum.repos.d]#  ipmitool sdr 或者 ipmitool sdr list
Inlet_Temp       | 24 degrees C      | ok
Outlet_Temp      | 37 degrees C      | ok
CPU0_Temp        | 63 degrees C      | ok
CPU1_Temp        | 52 degrees C      | ok
CPU0_DTS         | 4 degrees C       | ok
CPU1_DTS         | 7 degrees C       | ok
CPU0_DIMM_Temp   | 29 degrees C      | ok
CPU1_DIMM_Temp   | 29 degrees C      | ok
CPU0_VR_Temp     | 32 degrees C      | ok
CPU1_VR_Temp     | 33 degrees C      | ok
PCH_Temp         | 52 degrees C      | ok
OCP_Temp         | no reading        | ns
NVME_Temp        | 35 degrees C      | ok
PSU0_Temp        | 32 degrees C      | ok
PSU1_Temp        | 26 degrees C      | ok
RAID0_Temp       | no reading        | ns
RAID1_Temp       | no reading        | ns
RAID2_Temp       | no reading        | ns
RAID3_Temp       | no reading        | ns
GPU0_Temp        | no reading        | ns
GPU1_Temp        | 23 degrees C      | ok
GPU2_Temp        | no reading        | ns
GPU3_Temp        | no reading        | ns
GPU4_Temp        | 23 degrees C      | ok
GPU5_Temp        | no reading        | ns
GPU6_Temp        | no reading        | ns
GPU7_Temp        | no reading        | ns
PCIE_SSD0_Temp   | no reading        | ns
PCIE_SSD1_Temp   | no reading        | ns
PCIE_SSD2_Temp   | no reading        | ns
PCIE_SSD3_Temp   | no reading        | ns
PCIE_SSD4_Temp   | no reading        | ns
PCIE_SSD5_Temp   | no reading        | ns
PCIE_SSD6_Temp   | no reading        | ns
PCIE_SSD7_Temp   | no reading        | ns
M.2_Inlet_Temp   | 29 degrees C      | ok
Rear_HDDBP_Temp  | no reading        | ns
SWITCH0_Temp     | no reading        | ns
SWITCH1_Temp     | no reading        | ns
P3V3             | 3.28 Volts        | ok
P5V              | 5.08 Volts        | ok
P12V             | 12.06 Volts       | ok
CPU0_Vcore       | 1.76 Volts        | ok
CPU1_Vcore       | 1.76 Volts        | ok
CPU0_DDR_VDDQ1   | 1.22 Volts        | ok
CPU0_DDR_VDDQ2   | 1.22 Volts        | ok
CPU1_DDR_VDDQ1   | 1.22 Volts        | ok
CPU1_DDR_VDDQ2   | 1.22 Volts        | ok
CPU0_PVCCIO      | 1.01 Volts        | ok
CPU1_PVCCIO      | 1.00 Volts        | ok
PCH_P1V05        | 1.05 Volts        | ok
PCH_VNN          | 1 Volts           | ok
CPU0_Status      | 0x00              | ok
CPU1_Status      | 0x00              | ok
PSU0_Status      | 0x00              | ok
PSU1_Status      | 0x00              | ok
PSU_Redundant    | 0x00              | ok
PSU0_Fan_Status  | 0x00              | ok
PSU1_Fan_Status  | 0x00              | ok
FAN0_F_Speed     | 5760 RPM          | ok
FAN0_R_Speed     | 4896 RPM          | ok
FAN1_F_Speed     | 5760 RPM          | ok
FAN1_R_Speed     | 4896 RPM          | ok
FAN2_F_Speed     | 5760 RPM          | ok
FAN2_R_Speed     | 4896 RPM          | ok
FAN3_F_Speed     | 5760 RPM          | ok
FAN3_R_Speed     | 4896 RPM          | ok
FAN_M2_Speed     | 0 RPM             | ok
FAN0_Present     | 0x00              | ok
FAN1_Present     | 0x00              | ok
FAN2_Present     | 0x00              | ok
FAN3_Present     | 0x00              | ok
Total_Power      | 296 Watts         | ok
CPU_Power        | 158 Watts         | ok
MEM_Power        | 10 Watts          | ok
FAN_Power        | 25 Watts          | ok
HDD_Power        | 6 Watts           | ok
PSU0_POUT        | 136 Watts         | ok
PSU1_POUT        | 128 Watts         | ok
CPU0_C0D0        | 0x00              | ok
CPU0_C0D1        | 0x00              | ok
CPU0_C1D0        | 0x00              | ok
CPU0_C1D1        | 0x00              | ok
CPU0_C2D0        | 0x00              | ok
CPU0_C2D1        | 0x00              | ok
CPU0_C3D0        | 0x00              | ok
CPU0_C3D1        | 0x00              | ok
CPU0_C4D0        | 0x00              | ok
DISK0_Status     | 0x00              | ok
DISK1_Status     | 0x00              | ok
DISK2_Status     | 0x00              | ok
DISK3_Status     | 0x00              | ok
DISK4_Status     | 0x00              | ok
DISK5_Status     | 0x00              | ok
DISK6_Status     | 0x00              | ok
DISK7_Status     | 0x00              | ok
DISK8_Status     | 0x00              | ok
DISK9_Status     | 0x00              | ok
DISK10_Status    | 0x00              | ok
BMC_Boot_Up      | 0x00              | ok
ME_FW_Status     | 0x00              | ok
Event_Log        | 0x00              | ok
IPMI_Watchdog    | 0x00              | ok
CPU_ResourceRate | 0 unspecified     | ok
MEM_ResourceRate | 0 unspecified     | ok
HDD_ResourceRate | 0 unspecified     | ok
HDD_Max_Temp     | 35 degrees C      | ok

3:通過ipmitool修改帶外管理IP

配置IP地址:
格式: ipmitool lan set 通道ID  ipaddr  IP地址
[root@localhost tmp]# ipmitool lan set 1 ipaddr 10.57.60.91
Setting LAN IP Address to 10.57.60.91

配置子網掩碼:
格式: ipmitool lan set 通道ID  netmask  掩碼地址
[root@localhost tmp]# ipmitool lan set 1 netmask 255.255.255.0
Setting LAN Subnet Mask to 255.255.255.0

配置網關地址:
格式: ipmitool  lan  set  通道ID  defgw  ipaddr  網關地址
[root@localhost tmp]# ipmitool lan set 1 defgw ipaddr 10.57.60.1
Setting LAN Default Gateway IP to 10.57.60.1

查看網絡配置:
格式: ipmitool  lan  print 通道ID
[root@localhost tmp]# ipmitool lan print 1
Set in Progress         : Set Complete
Auth Type Support       : MD5 
Auth Type Enable        : Callback : MD5 
                        : User     : MD5 
                        : Operator : MD5 
                        : Admin    : MD5 
                        : OEM      : MD5 
IP Address Source       : Static Address
IP Address              : 10.57.60.91
Subnet Mask             : 255.255.255.0
MAC Address             : b4:05:5d:8b:8a:bd
SNMP Community String   : AMI
IP Header               : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10
BMC ARP Control         : ARP Responses Enabled, Gratuitous ARP Disabled
Gratituous ARP Intrvl   : 0.0 seconds
Default Gateway IP      : 10.57.60.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     : 0,1,2,3,6,7,8,11,12,15,16,17
Cipher Suite Priv Max   : caaaaaaaaaaaXXX
                        :     X=Cipher Suite Unused
                        :     c=CALLBACK
                        :     u=USER
                        :     o=OPERATOR
                        :     a=ADMIN
                        :     O=OEM
Bad Password Threshold  : 3
Invalid password disable: no
Attempt Count Reset Int.: 200
User Lockout Interval   : 300
[root@localhost tmp]#

4:啟動相應驅動模塊

[root@localhost tmp]# modprobe ipmi_msghandler
[root@localhost tmp]# modprobe ipmi_devintf
[root@localhost tmp]# modprobe ipmi_si
[root@localhost tmp]# modprobe ipmi_poweroff
[root@localhost tmp]# modprobe ipmi_watchdog
[root@localhost tmp]# 
[root@localhost tmp]# 
[root@localhost tmp]# lsmod |grep ^ipmi
ipmi_watchdog          32768  0
ipmi_poweroff          16384  0
ipmi_ssif              32768  0
ipmi_si                65536  2
ipmi_devintf           20480  0
ipmi_msghandler       110592  5 ipmi_devintf,ipmi_si,ipmi_watchdog,ipmi_ssif,ipmi_poweroff


5:ipmitool 電源管理

ipmitool -I lanplus -H 192.168.205.143 -U admin -P 密碼 power off (硬關機,直接切斷電源)
										  
ipmitool -I lanplus -H 192.168.205.143 -U admin -P 密碼 power soft (軟關機,即如同輕按一下開機按鈕)
										  
ipmitool -I lanplus -H 192.168.205.143 -U admin -P 密碼 power on (硬開機)
										  
ipmitool -I lanplus -H 192.168.205.143 -U admin -P 密碼 power reset (硬重啟)
										  
ipmitool -I lanplus -H 192.168.205.143 -U admin -P 密碼 power status (獲取當前電源狀態)
										  
ipmitool -I lanplus -H 192.168.205.143 -U admin -P 密碼 chassis power cycle

(注意power cycle 和power reset的區別在於前者從掉電到上電有1秒鍾的間隔,而后者是很快上電)

6:重置服務器BMC IP地址

問題描述:我們在日常運維管理中,浪潮服務器經常出現帶外管理無法登錄,需要重置BMC

 ipmitool -I lanplus -H 192.168.205.143 -U admin -P admin mc reset cold

7:IPMItool命令備忘單

IPMItool命令 描述
ipmitool help 顯示IPMItool的幫助信息
ipmitool mc info 檢查固件版本
ipmitool mc reset [warm/cold] 重置管理控制器
ipmitool fru print 顯示字段可替換單元的詳細信息

傳感器輸出命令 描述
ipmitool sdr list 列出系統上的所有傳感器名稱。每個傳感器將映射到其相應的傳感器編號
ipmitool sdr type list 列出系統上的所有傳感器類型。
ipmitool sdr type Fan 列出系統上的所有風扇類型傳感器。
ipmitool sdr type "Power Supply" 列出系統上的所有電源類型傳感器。
ipmitool sdr type Temperature 列出系統上的所有溫度類型傳感器。

機箱IPMItoll命令 描述
ipmitool chassis status ipmitool chassis identify [] 打開前面板識別燈
ipmitool [chassis] power soft 通過acpi進行軟關機
ipmitool [chassis] power cycle 強制關閉電源,等待1秒然后再打開電源的組合
ipmitool [chassis] power off 硬斷電
ipmitool [chassis] power on 硬啟動
ipmitool [chassis] power reset 硬重置

修改啟動設備 描述
ipmitool chassis bootdev pxe 修改啟動順序以首先啟動pxe
ipmitool chassis bootdev cdrom 修改啟動順序以首先啟動cdrom
ipmitool chassis bootdev bios 修改引導順序以首先引導BIOS

記錄IPMItools命令 描述
ipmitool sel info 返回有關系統事件日志的常規信息
ipmitool sel list 返回系統事件日志列表
ipmitool sel elist 返回與傳感器數據日志交叉引用的系統事件日志的列表
ipmitool sel get *ID* 返回有關特定事件日志的詳細信息(使用事件ID指定哪個日志)
ipmitool sel clear 清除事件日志


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM