ipmitool常用命令总结

IPMITool介绍安装

IPMItool用于访问IPMI的功能-智能平台管理接口,该系统接口管理和监视带外计算机系统。它是一个命令提示符,用于控制和配置IPMI支持的设备。

IPMItool 是一种可用在 linux系统下的命令行方式的 ipmi 平台管理工具,它支持 ipmi 1.5 规范(最新的规范为 ipmi 2.0).IPMI是一个开放的标准,监控,记录,回收,库存和硬件实现独立于主CPU,BIOS,以及操作系统的控制权。 服务处理器(或底板管理控制器,BMC)的背后是平台管理的大脑,其主要目的是处理自主传感器监控和事件记录功能。

 

在Linux平台上要配置IPMI需要有 /dev/ipmi0 设备存在,如果缺少该设备, ipmitool 工具就无法工作。此时需要使用如下方法创建设备:

# 安装    
yum  -y install epel-release    
yum  -y install ipmitool    
yum install OpenIPMI  ipmitool    
# 加载模块    
modprobe ipmi_watchdog    
modprobe ipmi_poweroff    
modprobe ipmi_devintf    
modprobe ipmi_msghandler    
modprobe ipmi_si    
 

参数  描述  

-h  帮助  

-V  显示版本信息  

-v  详细(可以使用多次)  

-c  以逗号分隔格式显示输出  

-d  指定要使用的/ dev / ipmiN设备(默认值= 0)  

-I  要使用的接口  

-H  LAN接口的远程主机名  

-p  远程RMCP端口[默认= 623]  

-U  远程会话用户  

-f  从文件读取远程会话密码  

-z  通信通道(OEM)的尺寸更改大小  

-S  使用本地文件进行远程SDR缓存  

-D  ttyb[:s]指定要使用的串行设备,波特率并且可选地指定该接口是系统接口  

-a  提示输入远程密码  

-Y  提示用于IPMIv2身份验证的Kg密钥  

-e  设置SOL转义字符  

-C  加密套件将被lanplus接口使用  

-k  使用Kg键进行IPMIv2身份验证  

-y  使用十六进制编码的Kg密钥进行IPMIv2身份验证  

-L  远程会话权限[默认=管理员] 附加一个’+’以在RAKP1中使用名称/特权查找  

-A  强制使用auth type NONE,PASSWORD,MD2,MD5或OEM  

-P  远程会话密码  

-E  从IPMI_PASSWORD环境变量读取密码  

-K  从IPMI_KGKEY环境变量中读取kgkey  

-m  设置本地IPMB地址  

-b  通道为桥接请求设置目标通道  

-t  将桥接请求发送到远程目标地址  

-B  为桥接请求设置传输通道(双桥)  

-T  设置桥接请求的传输地址(双桥)  

-l  设置原始命令的目的地lun  

-o  OEM设置(使用’list’查看可用的OEM类型)  

-O  将文件用于OEM SEL事件描述  

-N  指定lan [default = 2] / lanplus [default = 1]接口的超时时间  

-R  设置lan / lanplus接口的重试次数[默认= 4] 

# 首次使用  
ipmitool.exe  
  
No command provided!  
Commands:  
        raw           Send a RAW IPMI request and print response  
        i2c           Send an I2C Master Write-Read command and print response  
        lan           Configure LAN Channels  
        chassis       Get chassis status and set power state  
        power         Shortcut to chassis power commands  
        event         Send pre-defined events to MC  
        mc            Management Controller status and global enables  
        sdr           Print Sensor Data Repository entries and readings  
        sensor        Print detailed sensor information  
        fru           Print built-in FRU and scan SDR for FRU locators  
        sel           Print System Event Log (SEL)  
        pef           Configure Platform Event Filtering (PEF)  
        sol           Configure and connect IPMIv2.0 Serial-over-LAN  
        tsol          Configure and connect with Tyan IPMIv1.5 Serial-over-LAN  
        isol          Configure IPMIv1.5 Serial-over-LAN  
        user          Configure Management Controller users  
        channel       Configure Management Controller channels  
        session       Print session information  
        sunoem        OEM Commands for Sun servers  
        kontronoem    OEM Commands for Kontron devices  
        picmg         Run a PICMG/ATCA extended cmd  
        fwum          Update IPMC using Kontron OEM Firmware Update Manager  
        shell         Launch interactive IPMI shell  
        exec          Run list of commands from file  
        set           Set runtime variable for shell and exec 

# 查看 FRU 信息  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin fru  
FRU Device Description : Builtin FRU Device (ID 0)  
 Chassis Type          : Rack Mount Chassis  
 Chassis Part Number   : 412008232R2A  
 Chassis Serial        : 520190300001  
 Chassis Extra         : chassis extra 1  
 Chassis Extra         : chassis extra 2  
 Board Mfg             : Fiberhome  
 Board Product         : MB-CIDW16D-2GT  
 Board Serial          : 15088997A002  
 Board Part Number     : 15088997  
 Board Extra           : board extra  
 Product Manufacturer  : FiberHome  
 Product Name          : R2280 V7  
 Product Part Number   : 70475701A001  
 Product Version       : 1  
 Product Serial        : 1001  
 Product Asset Tag     : ....................  
 Product Extra         : product extra  
  
FRU Device Description : PSU2 FRU (ID 4)  
 Unknown FRU header version 0x00  
  
FRU Device Description : PSU1 FRU (ID 3)  
 Product Manufacturer  : GREAT WALL  
 Product Name          : CRPS1300D  
 Product Part Number   : CRPS1300D  
 Product Version       : 01  
 Product Serial        : 2L070023532  
 Power Supply Record  
  Capacity                   : 1300 W  
  Peak VA                    : 65535 VA  
  Inrush Current             : 255 A  
  Inrush Interval            : 0 ms  
  Input Voltage Range 1      : 90-132 V  
  Input Voltage Range 2      : 180-264 V  
  Input Frequency Range      : 0-63 Hz  
  A/C Dropout Tolerance      : 10 ms  
  Flags                      : 'Power factor correction' 'Autoswitch voltage' 'Hot swap'  
  Peak capacity              : 4095 W  
  Peak capacity holdup       : 0 s  
  Combined capacity          : not specified  
 DC Output Record  
  Output Number              : 2  
  Standby power              : Yes  
  Nominal voltage            : 12.20 V  
  Max negative deviation     : 11.60 V  
  Max positive deviation     : 12.80 V  
  Ripple and noise pk-pk     : 120 mV  
  Minimum current draw       : 0.100 A  
  Maximum current draw       : 3.000 A  

sensor操作

# 查看传感器读取信息 , 由于输出内容太多就不展示   
ipmitool sensor list  
# 设置传感器的告警阈值  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin sensor thresh help  
sensor thresh <id> <threshold> <setting>  
   id        : name of the sensor for which threshold is to be set  
   threshold : which threshold to set  
                 unr = upper non-recoverable  
                 ucr = upper critical  
                 unc = upper non-critical  
                 lnc = lower non-critical  
                 lcr = lower critical  
                 lnr = lower non-recoverable  
   setting   : the value to set the threshold to  
  
sensor thresh <id> lower <lnr> <lcr> <lnc>  
   Set all lower thresholds at the same time  
  
sensor thresh <id> upper <unc> <ucr> <unr>  
   Set all upper thresholds at the same time  

# 单独获取某一个传感器的状态信息  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin sensor get CPU_TEMP_01  
Locating sensor record...  
Sensor ID              : CPU_TEMP_01 (0x3)  
 Entity ID             : 3.1  
 Sensor Type (Analog)  : Temperature  
 Sensor Reading        : 42 (+/- 1) degrees C  
 Status                : ok  
 Lower Non-Recoverable : na  
 Lower Critical        : na  
 Lower Non-Critical    : na  
 Upper Non-Critical    : 91.000  
 Upper Critical        : 93.000  
 Upper Non-Recoverable : na  
 Assertion Events      :  
 Assertions Enabled    : unc+ ucr+  
 Deassertions Enabled  : unc+ ucr+  

# 单独获取某一个传感器的当前值  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin sensor reading CPU_TEMP_01  
CPU_TEMP_01      | 42  

sdr操作

# 查看sdr的配置信息  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin sdr info  
SDR Version                         : 0x51  
Record Count                        : 379  
Free Space                          : 8241 bytes  
Most recent Addition                : 01/01/1970 07:59:59  
Most recent Erase                   :  
SDR overflow                        : no  
SDR Repository Update Support       : non-modal  
Delete SDR supported                : no  
Partial Add SDR supported           : yes  
Reserve SDR repository supported    : yes  
SDR Repository Alloc info supported : no  

# 传感器仓库sdr  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin sdr help  
SDR Commands:  list | elist [all|full|compact|event|mcloc|fru|generic]  
                     all        All SDR Records  
                     full       Full Sensor Record  
                     compact    Compact Sensor Record  
                     event      Event-Only Sensor Record  
                     mcloc      Management Controller Locator Record  
                     fru        FRU Locator Record  
                     generic    Generic Device Locator Record  
               type [sensor type]  
                     list       Get a list of available sensor types  
               info  
                     Display information about the repository itself  
               entity <id>[.<instance>]  
                     Display all sensors associated with an entity  
               dump <file>  
                     Dump raw SDR data to a file  

# 查看sdr所有的信息,list和elist的格式上略有不同  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin sdr list  
INPUT_TEMP       | 25 degrees C      | ok  
OUTPUT_TEMP      | 29 degrees C      | ok  
CPU_TEMP_01      | 42 degrees C      | ok  
CPU_TEMP_02      | 50 degrees C      | ok  
PCH_TEMP         | 45 degrees C      | ok  
MEM_TMP_ABCD_P1  | no reading        | ns  
MEM_TMP_EFGH_P1  | no reading        | ns  
MEM_TMP_ABCD_P2  | no reading        | ns  
MEM_TMP_EFGH_P2  | no reading        | ns  
VR_TEMP_P1       | 41 degrees C      | ok  
VR_TEMP_P2       | 47 degrees C      | ok  
MB_INPUT_TEMP    | 28 degrees C      | ok  
MB_OUTPUT_TEMP   | 32 degrees C      | ok  
TControl_P1      | 8 degrees C       | ok  
TControl_P2      | 8 degrees C       | ok  
  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin sdr elist  
INPUT_TEMP       | 01h | ok  |  7.1 | 25 degrees C  
OUTPUT_TEMP      | 02h | ok  |  7.2 | 29 degrees C  
CPU_TEMP_01      | 03h | ok  |  3.1 | 42 degrees C  
CPU_TEMP_02      | 04h | ok  |  3.5 | 50 degrees C  
PCH_TEMP         | 05h | ok  |  3.3 | 44 degrees C  
MEM_TMP_ABCD_P1  | 06h | ns  | 32.1 | No Reading  
MEM_TMP_EFGH_P1  | 07h | ns  | 32.5 | No Reading  
MEM_TMP_ABCD_P2  | 08h | ns  | 32.9 | No Reading  
MEM_TMP_EFGH_P2  | 09h | ns  | 32.13 | No Reading  
VR_TEMP_P1       | 0Ah | ok  |  3.8 | 41 degrees C  
VR_TEMP_P2       | 0Bh | ok  |  3.9 | 47 degrees C  
MB_INPUT_TEMP    | 0Ch | ok  |  7.3 | 28 degrees C  
MB_OUTPUT_TEMP   | 0Dh | ok  |  7.4 | 32 degrees C  
TControl_P1      | 30h | ok  |  3.3 | 8 degrees C  
TControl_P2      | 31h | ok  |  3.7 | 8 degrees C  
P12V             | 40h | ok  |  7.1 | 12.10 Volts  
P12V_AUX         | 41h | ok  |  7.19 | 12.10 Volts  
# 查看传感器数据  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin sdr elist full  
INPUT_TEMP       | 01h | ok  |  7.1 | 25 degrees C  
OUTPUT_TEMP      | 02h | ok  |  7.2 | 29 degrees C  
CPU_TEMP_01      | 03h | ok  |  3.1 | 41 degrees C  
CPU_TEMP_02      | 04h | ok  |  3.5 | 49 degrees C  
PCH_TEMP         | 05h | ok  |  3.3 | 45 degrees C  
MEM_TMP_ABCD_P1  | 06h | ns  | 32.1 | No Reading  
MEM_TMP_EFGH_P1  | 07h | ns  | 32.5 | No Reading  
MEM_TMP_ABCD_P2  | 08h | ns  | 32.9 | No Reading  
MEM_TMP_EFGH_P2  | 09h | ns  | 32.13 | No Reading  
...................................  

# 查看传感器有哪些类型  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin sdr type list  
Sensor Types:  
        Temperature                 Voltage  
        Current                     Fan  
        Physical Security           Platform Security  
        Processor                   Power Supply  
        Power Unit                  Cooling Device  
        Other                       Memory  
        Drive Slot / Bay            POST Memory Resize  
        System Firmwares            Event Logging Disabled  
        Watchdog                    System Event  
        Critical Interrupt          Button  
        Module / Board              Microcontroller  
        Add-in Card                 Chassis  
        Chip Set                    Other FRU  
        Cable / Interconnect        Terminator  
        System Boot Initiated       Boot Error  
        OS Boot                     OS Critical Stop  
        Slot / Connector            System ACPI Power State  
        Watchdog                    Platform Alert  
        Entity Presence             Monitor ASIC  
        LAN                         Management Subsystem Health  

# 查看指定类型的数据  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin sdr type Temperature  
INPUT_TEMP       | 01h | ok  |  7.1 | 25 degrees C  
OUTPUT_TEMP      | 02h | ok  |  7.2 | 29 degrees C  
CPU_TEMP_01      | 03h | ok  |  3.1 | 42 degrees C  
CPU_TEMP_02      | 04h | ok  |  3.5 | 49 degrees C  
PCH_TEMP         | 05h | ok  |  3.3 | 45 degrees C  
MEM_TMP_ABCD_P1  | 06h | ns  | 32.1 | No Reading  
MEM_TMP_EFGH_P1  | 07h | ns  | 32.5 | No Reading  
MEM_TMP_ABCD_P2  | 08h | ns  | 32.9 | No Reading  
MEM_TMP_EFGH_P2  | 09h | ns  | 32.13 | No Reading  
........................  

# 查看电源的个数,有一个电源  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin sdr type "Power Unit"  
POWER_STATUS     | E8h | ok  | 19.1 |  

# 查看指定sdr的配置信息  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin sdr get PCH_TEMP  
Sensor ID              : PCH_TEMP (0x5)  
 Entity ID             : 3.3 (Processor)  
 Sensor Type (Analog)  : Temperature  
 Sensor Reading        : 45 (+/- 1) degrees C  
 Status                : ok  
 Nominal Reading       : 32.000  
 Normal Minimum        : -16.000  
 Normal Maximum        : 75.000  
 Upper critical        : 95.000  
 Upper non-critical    : 93.000  
 Positive Hysteresis   : Unspecified  
 Negative Hysteresis   : Unspecified  
 Minimum sensor range  : -16.000  
 Maximum sensor range  : Unspecified  
 Event Message Control : Per-threshold  
 Readable Thresholds   : unc ucr  
 Settable Thresholds   : unc ucr  
 Threshold Read Mask   : unc ucr unr  
 Assertion Events      :  
 Assertions Enabled    : unc+ ucr+  
 Deassertions Enabled  : unc+ ucr+  

lan参数

# 可选参数    
ipmitool.exe -I lanplus -H <ip地址> -U <用户名> -P <密码> lan help    
LAN Commands:    
                   print [<channel number>]    
                   set [<channel number>]    
                   alert [<channel number>]    
                   stats get [<channel number>]    
                   stats clear [<channel number>]   

ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin lan print 1  
Set in Progress         : Set Complete  
Auth Type Support       :  
Auth Type Enable        : Callback :  
                        : User     :  
                        : Operator :  
                        : Admin    :  
                        : OEM      :  
IP Address Source       : Static Address  
IP Address              : 10.41.82.228  
Subnet Mask             : 255.255.252.0  
MAC Address             : 2c:f0:12:14:26:96  
SNMP Community String   : P@ssw0rd  
IP Header               : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10  
BMC ARP Control         : ARP Responses Enabled, Gratuitous ARP Disabled  
Gratituous ARP Intrvl   : 1.0 seconds  
Default Gateway IP      : 10.41.80.254  
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  

ipmitool lan set 1 ipsrc dhcp # 设置 ipmi 通过dhcp获取IP    
ipmitool lan print 1    
ipmitool lan set 1 ipsrc static # 设置 ipmi 配置静态 ip    
ipmitool lan set 1 ipaddress 10.1.0.10 # 设置 ipmi 的 ip 为 10.1.0.10    
ipmitool lan set 1 netmask 255.255.255.0 # 设置 ipmi 的掩码    
ipmitool lan set 1 defgw ipaddr 10.1.0.1 # 设置 ipmi 的默认网关    
ipmitool lan set 2 defgw macaddr 00:0e:0c:aa:8e:13  
ipmitool lan set 2 arp respond on  
ipmitool lan set 2 auth ADMIN MD5  
ipmitool lan set 2 access on 

# 设置channel 1 上snmp的community为public。  
ipmitool.exe -I lanplus -H <IP地址> -U admin -P admin lan set 1 snmp public  
Setting LAN SNMP Community String to public  
  
# 验证查看  
ipmitool.exe -I lanplus -H <IP地址> -U admin -P admin lan print 1  
......................  
SNMP Community String   : public  
....................  

# 打印trap信息  
ipmitool.exe -I lanplus -H <IP地址> -U ADMIN -P ADMIN lan alert print 1  
  
# 设置trap  
ipmitool.exe -I lanplus -H <IP地址> -U ADMIN -P ADMIN lan alert set 1 1 help  
  
usage: lan alert set <channel> <alert> <command> <option>  
  
  ipaddr <x.x.x.x>               Set alert IP address  
  macaddr <x:x:x:x:x:x>          Set alert MAC address  
  gateway <default|backup>       Set channel gateway to use for alerts  
  ack <on|off>                   Set Alert Acknowledge on or off  
  type <pet|oem1|oem2>           Set destination type as PET or OEM  
  time <seconds>                 Set ack timeout or unack retry interval  
  retry <number>                 Set number of alert retries  

user设置

ipmitool.exe  user  
Not enough parameters given.  
User Commands:  
               summary      [<channel number>]  
               list         [<channel number>]  
               set name     <user id> <username>  
               set password <user id> [<password> <16|20>]  
               disable      <user id>  
               enable       <user id>  
               priv         <user id> <privilege level> [<channel number>]  
                     Privilege levels:  
                      * 0x1 - Callback  
                      * 0x2 - User  
                      * 0x3 - Operator  
                      * 0x4 - Administrator  
                      * 0x5 - OEM Proprietary  
                      * 0xF - No Access  
  
               test         <user id> <16|20> [<password]>  
  
ipmitool.exe  user summary 1  # 查看用户汇总信息  
Maximum IDs         : 10  
Enabled User Count  : 5  
Fixed Name Count    : 2  

ipmitool user list     # 查看用户信息      
ipmitool user set name <user id> <username>  #增加用户      
ipmitool user set password <user id> <password>  # 设置密码      
ipmitool user priv <user id> <privilege level> [ChannelNo]  # 设置用户权限      
ipmitool user enable/disable <user id> #  启用/禁用用户    
# 模拟登录    
ipmitool.exe -I lanplus -H <IP地址> -U <账号> -P <密码> user test 2 16 ADMIN    
# 查询概要信息      
ipmitool.exe -I lanplus -H <ip地址> -U <账号> -P <密码> user summary     
  
# 案例一:修改ID 2 root的密码    
ipmitool -I lanplus -H <IP地址> -U root -P admin123456 user set password 2 yxctyun@123456      
      
# 案例二:在UID为5的位置添加ironic用户。设置密码vAy96gymdzP。管理员权限      
ipmitool -I lanplus -H <IP地址> -U ADMIN -P ADMIN user set name 5 ironic      
ipmitool -I lanplus -H <IP地址> -U ADMIN -P ADMIN user set password 5 vAy96gymdzP    
# 设置用户权限    
ipmitool -I lanplus -H <IP地址> -U ADMIN -P ADMIN user priv 5 0x4 1      
ipmitool -I lanplus -H <IP地址> -U ADMIN -P ADMIN user priv 5 0x4 8      
# 激活账号    
ipmitool -I lanplus -H <IP地址> -U ADMIN -P ADMIN user enable 5      
# 设置用户在通道上的权限   
ipmitool -I lanplus -H <IP地址> -U ADMIN -P ADMIN channel setaccess 1 5 callin=on ipmi=on link=on privilege=4   
  
ipmitool -I lanplus -H <IP地址> -U ADMIN -P ADMIN channel setaccess 8 5 callin=on ipmi=on link=on privilege=4    
# -----------------------------------------   

注解:

[privilege=level] 配置参数可以在 ipmitool channel setaccess 输出看到:

Possible privilege levels are:
   1   Callback level
   2   User level
   3   Operator level
   4   Administrator level
   5   OEM Proprietary level
  15   No access

所以设置值为 4 就是管理员级别

channel参数

# 查看支持命令    
ipmitool.exe -I lanplus -H <ip地址> -U <用户名> -P <密码> channel help    
Channel Commands: authcap   <channel number> <max privilege>    
                  getaccess <channel number> [user id]    
                  setaccess <channel number> <user id> [callin=on|off] [ipmi=on|off] [link=on|off] [privilege=level]    
                  info      [channel number]    
                  getciphers <ipmi | sol> [channel]    


# 获取通道信息     
ipmitool.exe -I lanplus -H <ip地址> -U <用户名> -P <密码> channel info    
    
# 获取用户通道权限信息    
ipmitool.exe -I lanplus -H <ip地址> -U <用户名> -P <密码> channel getaccess 1    
    
# 设置用户通道权限    
ipmitool -I lanplus -H <ip地址> -U <用户名> -P <密码> channel setaccess 1 5 callin=on ipmi=on link=on privilege=4       
# 具体的解释如下:
- channel setaccess:这是ipmitool中的一个命令,用于设置IPMI通道的访问权限。
- 1:表示要设置的通道号,这个命令中是通道号为1。
- 5:表示要设置的用户ID,这个命令中是用户ID为5。
- callin=off:表示禁止该通道的用户通过IPMI远程呼叫进行访问。
- ipmi=on:表示允许该通道的用户通过IPMI进行访问。
- privilege=4:表示设置用户的权限等级为4,即操作员级别权限。
    
# 获取通道认证鉴权能力    
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> channel authcap <channel number> <max privilege>    
    
# 获取通道的加密法套件    
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> channel getciphers <ipmi|sol> <channel>  

sel操作

# 查看sel的状态信息  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin sel info  
SEL Information  
Version          : 1.5 (v1.5, v2 compliant)  
Entries          : 9  
Free Space       : 65341 bytes  
Percent Used     : 0%  
Last Add Time    : 10/08/2022 22:15:31  
Last Del Time    : Not Available  
Overflow         : false  
Supported Cmds   : 'Delete' 'Partial Add' 'Reserve' 'Get Alloc Info'  
# of Alloc Units : 3448  
Alloc Unit Size  : 19  
# Free Units     : 3439  
Largest Free Blk : 3439  
Max Record Size  : 13  

ipmitool sel list  # 查看 BMC 事件日志   
ipmitool sel elist   # 显示所有系统事件日志    
ipmitool sel clear   # 删除所有系统时间日志    
ipmitool sel delete ID     # 删除第ID条SEL    
ipmitool sel time get     # 显示当前BMC的时间    
ipmitool sel time set  XXX   # 设置当前BMC的时间  

event模拟告警命令

# 模拟服务器告警  
ipmitool.exe event 1  
ipmitool.exe event 2  
ipmitool.exe event 3  
  
usage: event <num>  
   Send generic test events  
   1 : Temperature - Upper Critical - Going High  
   2 : Voltage Threshold - Lower Critical - Going Low  
   3 : Memory - Correctable ECC  

chassis操作

# 支持参数  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin chassis  
Chassis Commands:  status, power, identify, policy, restart_cause, poh, bootdev, selftest  

# 查看底盘状态,其中包括了底盘电源信息,底盘工作状态等  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin chassis status  
System Power         : on  
Power Overload       : false  
Power Interlock      : inactive  
Main Power Fault     : false  
Power Control Fault  : false  
Power Restore Policy : always-on  
Last Power Event     : ac-failed  
Chassis Intrusion    : inactive  
Front-Panel Lockout  : inactive  
Drive Fault          : false  
Cooling/Fan Fault    : false  
Sleep Button Disable : allowed  
Diag Button Disable  : allowed  
Reset Button Disable : allowed  
Power Button Disable : allowed  
Sleep Button Disabled: true  
Diag Button Disabled : true  
Reset Button Disabled: true  
Power Button Disabled: true  

# 修改启动顺序  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin chassis bootdev <device>  
bootdev <device> [clear-cmos=yes|no]  
  none  : Do not change boot device order  
  pxe   : Force PXE boot  
  disk  : Force boot from default Hard-drive  
  safe  : Force boot from default Hard-drive, request Safe Mode  
  diag  : Force boot from Diagnostic Partition  
  cdrom : Force boot from CD/DVD  
  bios  : Force boot into BIOS Setup  

# 设置启动项的参数  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin chassis bootparam  
bootparam get <param #>  
bootparam set bootflag <flag>  
  force_pxe   : Force PXE boot  
  force_disk  : Force boot from default Hard-drive  
  force_safe  : Force boot from default Hard-drive, request Safe Mode  
  force_diag  : Force boot from Diagnostic Partition  
  force_cdrom : Force boot from CD/DVD  
  force_bios  : Force boot into BIOS Setup  

# 管理电源恢复策略    
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin chassis policy    
chassis policy <state>    
   list        : return supported policies    
   always-on   : turn on when power is restored    
   previous    : return to previous state when power is restored    
   always-off  : stay off after power is restored   

# 查看上次重启的原因  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin chassis restart_cause  
System restart cause: chassis power control command  
 
ipmitool chassis power on  # 用此命令可以远程开机  
ipmitool chassis power off   # 用此命令可以远程关机  
ipmitool chassis power reset  # 实现硬重启,用此命令可以远程开机  

# 查询上电时间  
ipmitool.exe -I lanplus -H 10.41.82.228 -U admin -P admin chassis poh  
POH Counter  : 509 hours total (21 days, 5 hours)  

mc操作

# MC可选参数    
ipmitool.exe -H <IP地址> -I lanplus -U <用户名> -P <密码> mc    
MC Commands:    
  reset <warm|cold>    
  info    
  selftest    
  getenables    
  setenables <option=on|off> ...    
    recv_msg_intr         Receive Message Queue Interrupt    
    event_msg_intr        Event Message Buffer Full Interrupt    
    event_msg             Event Message Buffer    
    system_event_log      System Event Logging    
    oem0                  OEM 0    
    oem1                  OEM 1    
    oem2                  OEM 2    
  
#列出BMC所有允许的选项    
ipmitool.exe -H <IP地址> -I lanplus -U <用户名> -P <密码> mc getenables    
Receive Message Queue Interrupt          : enabled    
Event Message Buffer Full Interrupt      : disabled    
Event Message Buffer                     : disabled    
System Event Logging                     : enabled    
OEM 0                                    : disabled    
OEM 1                                    : disabled    
OEM 2                                    : disabled    
  
# 设置bmc相应的允许/禁止选项。  
ipmitool.exe -H <IP地址> -I lanplus -U <用户名> -P <密码> mc setenables =[on|off]   
  
ipmitool mc reset cold   # BMC 冷启动  
ipmitool mc reset warm   # BMC 热启动  
# 查询BMC自测试结果      
ipmitool.exe -H <IP地址> -I lanplus -U <用户名> -P <密码> mc selftest     
# 查询BMC GUID信息    
ipmitool.exe -I lanplus -H <IP地址> -U <用户名> -P <密码> mc guid    
# 控制前插板指示灯亮(定位灯)    
ipmitool.exe -I lanplus -H <IP地址> -U <用户名> -P <密码> chassis identify   

 pef参数

# 设置 Platform Event Filtering (PEF),事件过滤平台用于在监控系统发现有event时候,用PEF中的策略进行事件过滤,然后看是否需要报警。 
# 打印Platform Event Filtering (pef)信息      
  
ipmitool.exe -H <IP地址> -I lanplus -U <用户名> -P <密码> pef info      
  
# 查看Platform Event Filtering (pef)状态      
  
ipmitool.exe -H <IP地址> -I lanplus -U <用户名> -P <密码> pef status      
  
# 查看Platform Event Filtering (pef)策略设置      
  
ipmitool.exe -H <IP地址> -I lanplus -U <用户名> -P <密码> pef policy  

sol参数

SOL需要IPMI2.0支持,使用lanplus进行远程连接。

Serial Over LAN (SOL) 功能非常有用。SOL 通过 IPMI 会话重定向本地串行接口,允许远程访问 Windows 的紧急事件管理控制台 (EMS) 特殊管理控制台 (SAC),或访问 LINUX 串行控制台。

# 可选参数    
ipmitool.exe -I lanplus -H <IP地址> -U <用户名> -P <密码> sol help    

SOL Commands: info [<channel number>]    

              set <parameter> <value> [channel]    

              activate    

              deactivate    

              looptest [<loop times>] [<loop interval(in ms)>]   

# 显示SOL参数配置信息  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> sol info  

# 建立SOL会话  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> sol activate  

# 关闭SOL会话  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> sol deactivate  

# 设置SOL通道1使能状态  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> sol set enabled <true|false> <channel>
  

# 可选参数    
ipmitool.exe -I lanplus -H <ip地址> -U <用户名> -P <密码> sol set    

SOL set parameters and values:    

  set-in-progress             set-complete | set-in-progress | commit-write    

  enabled                     true | false    

  force-encryption            true | false    

  force-authentication        true | false    

  privilege-level             user | operator | admin | oem    

  character-accumulate-level  <in 5 ms increments>    

  character-send-threshold    N    

  retry-count                 N    

  retry-interval              <in 10 ms increments>    

  non-volatile-bit-rate       serial | 9.6 | 19.2 | 38.4 | 57.6 | 115.2    

  volatile-bit-rate           serial | 9.6 | 19.2 | 38.4 | 57.6 | 115.2   

# 设置SOL参数状态  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> sol set set-in-progress <set-complete|set-in-progress|commit-write>  

# 设置SOL负载是否强制加密  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> sol set force-encryption <true|false>  

# 设置SOL负载是否强制认证  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> sol set force-authentication <true|false>  

# 设置建立SOL会话的最低权限级别  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> sol set privilege-level <user|operator|admin|oem>  

# 设置SOL字符发送间隔,一个单位为5 ms  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> sol set character-accumulate-level <level>  

# 设置SOL字符门限(32字节)  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> sol set character-send-threshold <bytes>  

# 设置SOL重发次数  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> sol set retry-count <count>  

# 设置SOL重发时间间隔(一个单位为10 ms)  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> sol set retry-interval <interval>  

# 设置用户对负载的访问权限(和命令参数名不一致)  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> sol payload <enable|disable> <channel> <用户ID>  

# SOL连接压力测试  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> sol looptest <loop-times> <loop-interval>  
  
# 设置SOL串口波特率:    
ipmitool -H (BMC的管理IP地址) -I lanplus -U (BMC登录用户名) -P (BMC 登录用户名的密码) sol set volatile-bit-rate <9.6/19.2/38.4/57.6/115.2>  

lan6参数

ipmitool.exe -I lanplus -H 192.168.2.100 -U admin -P admin lan6  
  help [command]  
  save <channel> [<parameter> [<set_sel> [<block_sel>]]]  
  set <channel> [nolock] <parameter> [<set_sel> [<block_sel>]] <values...>  
  print <channel> [<parameter> [<set_sel> [<block_sel>]]]  
  lock <channel>  
  commit <channel>  
  discard <channel>  
# 查看IPv6地址  
ipmitool.exe -I lanplus -H 10.41.83.111 -U yfadmin -P yfadmin lan6 print 1  
  
ipmitool.exe -I lanplus -H 10.41.83.111 -U yfadmin -P yfadmin lan6 set  
  set <channel> [nolock] <parameter> [<set_sel> [<block_sel>]] <values...>  
  
   available parameters:  
    enables {ipv4|ipv6|both}  
    traffic_class <value>  
    static_hops <value>  
    flow_label <value>  
    static_addr <set_sel> {enable|disable} <addr> <pfx_len>  
    static_duid <set_sel> <block_sel> <data>  
    dynamic_duid <set_sel> <block_sel> <data>  
    dhcp6_cfg <set_sel> <data> <data>  
    rtr_cfg {static|dynamic|both}  
    static_rtr <set_sel> <addr> <macaddr> <prefix> <prefix_len>  
    ndslaac_cfg <set_sel> <data>  

其他参数用法

# 从文件中读取命令  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码>  exec <filename>

# 交互式执行命令  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码>  shell  

# 获取目前有活动会话  
ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码>  session info <active>  

 

posted @ 2022-04-10 18:41  杨灏  阅读(12581)  评论(0编辑  收藏  举报