服务器之ipmitool

一般命令
raw                #发送一个原始的IPMI请求,并且打印回复信息。
Lan                #配置网络(lan)信道(channel)
chassis            #查看底盘的状态和设置电源
event              #向BMC发送一个已经定义的事件(event),可用于测试配置的SNMP是否成功
mc                 #查看MC(Management Contollor)状态和各种允许的项
sdr                #打印传感器仓库中的所有监控项和从传感器读取到的值。
Sensor             #打印详细的传感器信息。
Fru                #打印内建的Field Replaceable Unit (FRU)信息
Sel                #打印 System Event Log (SEL)
Pef                #设置 Platform Event Filtering (PEF),事件过滤平台用于在监控系统发现有event时候,用PEF中的策略进行事件过滤,然后看是否需要报警。
Sol/isol           #用于配置通过串口的Lan进行监控
User               #设置BMC中用户的信息 。
Channel            #设置Management Controller信道。
Ipmitool –I open sensor list              #命令可以获取传感器中的各种监测值和该值的监测阈值,包括(CPU温度,电压,风扇转速,电源调制模块温度,电源电压等信息)
Ipmitool –I open sensor get “CPU0Temp”  #可以获取ID为CPU0Temp监测值,CPU0Temp是sensor的ID,服务器不同,ID表示也不同。
Ipmitool –I open sensor thresh          #设置ID值等于id的监测项的各种限制值。
Ipmitool –I open chassis status         #查看底盘状态,其中包括了底盘电源信息,底盘工作状态等
Ipmitool –I open chassis restart_cause  #查看上次系统重启的原因
Ipmitool –I open chassis policy list    #查看支持的底盘电源相关策略。
Ipmitool –I open chassis power on       #启动底盘,用此命令可以远程开机
Ipmitool –I open chassis power off      #关闭底盘,用此命令可以远程关机
Ipmitool –I open chassis power reset    #实现硬重启,用此命令可以远程重启
#Ipmi还可以设置系统启动boot的设备,具体见ipmitool帮助文档
Ipmitool –I open mc reset                #使BMC重新硬启动
Ipmitool –I open mc info                 #查看BMC硬件信息
Ipmitool –I open mc getenables           #列出BMC所有允许的选项
Ipmitool –I open mc setenables =[on|off] #设置bmc相应的允许/禁止选项。
Ipmitool-I open event 1                  #发送一个温度过高的消息到System Event Log中,可以发送的Event有:
Temperature: Upper Critical: Going High
Voltage Threshold: Lower Critical: Going Low
Memory: Correctable ECC Error Detected
Ipmitool-I open event                          #命令可以用测试配置的IPMI中的snmp功能是否成功。
Ipmitool -I open lan print 1                   #打印现咱channel 1的信息 。
Ipmitool -I open lan set 1 ipaddr 10.10.113.95 #设置channel 1的IP地址为10.10.113.95
Ipmitool -I open lan set 1 snmp public         #设置channel 1 上snmp的community为public。
Ipmitool -I open lan set 1 access on           #设置channel 1允许访问。
Ipmitool -I open pef info                      #打印Platform Event Filtering (pef)信息
Ipmitool -I open pef status                    #查看Platform Event Filtering (pef)状态
Ipmitool -I open pef policy                    #查看Platform Event Filtering (pef)策略设置
Ipmitool -I open sdr list fru                  #读取fru信息并显示。
ipmitool sel clear                             #清除记录
ipmitool sel elist
ipmitool sel list
ipmitool fru
ipmitool fru print                             #显示fru信息
ipmitool fru print 0
ipmitool fru print 1
ipmitool bmc reset cold                        #重启bmc
ipmitool sdr                                   #查看psu fan (BAT)等信息
ipmitool sdr type fan
ipmitool mc info                               #查看bmc信息
ipmitool lan print                             #显示lan信息
ipmitool lan print|egrep "MAC Address"         #得到bmc的oui
ipmitool lan set 1 ipsrc dhcp                  #设置动态ip 1用户
ipmitool -H $bmc_ip -U admin -P admin mc info  #设置用户名密码
ipmitool chassis policy always-off
ipmitool chassis identify force
ipmitool chassis identify off
ipmitool sdr type Temperature
ipmitool sol payload enable 1
IPMI RAW command
参照IPMI spec 2.0 with KCS
BMC 可以控制的功能很多, 除了常用的ipmi command, 其馀还有许多,可以依靠RAW command 来与BMC 沟通完成, 并且有"隐藏"的command 可以用,尤其是OEM command, 可以询问各机种BMC RD
以下整理出来较有用的command, 需注意Data 的Request/Response 起始位置。
Request 指令格式 "ipmitool raw NetFnCode CommandCode Data .."
Ex.ipmitool raw 0x0C 0x02 0x01 0x04 0x00 0x00(Get BMC IP Source)
0x0C Request Transport Media-specific configuration & control
0x02 GET LAN Config
0x01 Channel Num
0x04 IP Source(Selector)
0x00 not use set Selector
0x00 not require block num
Response 指令格式 "NetFnCode CommandCode CopmpletionCode Data .."
Ex.0x0D 0x02 0x00 0x01
0x0D Response Transport Media-specific configuration & control
0x02 GET LAN Config
0x00 Command Completed Successful
0x01 IP source is Static
## NetFn code
0x00(request), 0x01(Response) Chassis
0x02(request), 0x03(Response) Bridge
0x04(request), 0x05(Response) Sensor/Event
0x06(request), 0x07(Response) Application
0x08(request), 0x09(Response) Firmware Transfer
0x0A(request), 0x0B(Response) Non-volatile storage
0x0C(request), 0x0D(Response) Transport Media-specific configuration & control
0x0E- 0x2B Reserved
2Ch-2Dh Extension Non-IPMI group
2Eh-2Fh OEM/Non-IPMI group
30h-3Fh Controllerspecific OEM/Group
## Completion Code
0x00 Command Completed Normally
0xC0 Node Busy
0xC1 Invalid Command
0xC2 Command invalid for given NetFn
0xC3 Timeout
0xC4 Storage Out of space
0xC5 Reservation Canceled or Invalid Reservation ID
0xC6 Request data truncated
0xC7 Request data length invalid
0xC8 Request data field length limit exceeded
0xC9 Parameter/Data out of range
0xCA Cannot return number of requested data bytes
0xCB Requested Sensor, data, or record not present
0xCC Invalid data field in Request
0xCD Command illegal for specified sensor or record type
0xCE Command response could not be provided
0xCF Cannot execute duplicated request
0xD0 Command response could not be provided. SDR Repository in update mode.
0xD1 Command response could not be provided. Device in firmware update mode.
0xD2 Command response could not be provided. BMC initialization or
initializationagent in progress
0xD3 Destination unavailable
0xD4 Cannot execute command due to insufficient privilege level or other
securitybased restriction
0xD5 Cannot execute command. Command or parameter not supported in present
state
0xD6 Cannot execute command. Parameter is illegal
0xFF Unspecified error
0x01-0x7E OEM completion codes
0x80-0xBE Standard command-specific codes
0x7F, 0xBF, 0xD7-0xFE Reserved

 

摘自:https://blog.csdn.net/qq_44238024/article/details/125600431

posted @ 2022-07-11 10:29  fengjian1585  阅读(859)  评论(0编辑  收藏  举报