ipmitool工具安装以及常见使用方法

2023-10-20 14:35:31 浏览数 (1)

IPMItool是一个用于管理和配置,支持智能平台管理接口(IPMI)1.5版和2.0版规范的设备的实用程序。 IPMI是一个开放的标准,监控,记录,回收,库存和硬件实现独立于主CPU,BIOS,以及操作系统的控制权。 服务处理器(或底板管理控制器,BMC)的背后是平台管理的大脑,其主要目的是处理自主传感器监控和事件记录功能。

下载部署

代码语言:javascript复制
wget http://rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/OpenIPMI-2.0.27-1.el7.x86_64.rpm
wget http://rpmfind.net/linux/centos/7.6.1810/os/x86_64/Packages/ipmitool-1.8.18-7.el7.x86_64.rpm
wget http://rpmfind.net/linux/centos/7.6.1810/os/x86_64/Packages/OpenIPMI-modalias-2.0.23-2.el7.x86_64.rpm

yum -y localinstall OpenIPMI-2.0.27-1.el7.x86_64.rpm ipmitool-1.8.18-7.el7.x86_64.rpm OpenIPMI-modalias-2.0.23-2.el7.x86_64.rpm

设置

加载驱动

代码语言:javascript复制
modprobe ipmi_devintf
modprobe ipmi_watchdog
modprobe ipmi_poweroff
modprobe ipmi_si (虚拟机会报错:modprobe: ERROR: could not insert 'ipmi_si': No such device,可忽略。)
modprobe ipmi_msghandler
````
</br>
### 查看加载状态

[root@remote-jump ~]# lsmod | grep ipmi ipmi_ssif 36864 0 ipmi_si 61440 0 ipmi_devintf 20480 0 ipmi_msghandler 102400 3 ipmi_devintf,ipmi_si,ipmi_ssif

代码语言:javascript复制
</br>

### 重启服务

systemctl restart ipmi

代码语言:javascript复制
</br>
## 命令help

[root@remote-jump ~]# ipmitool help Commands:

代码语言:javascript复制
    raw           Send a RAW IPMI request and print response
                  # 发送一个原始的IPMI请求,并且打印回复信息。
    i2c           Send an I2C Master Write-Read command and print response
    spd           Print SPD info from remote I2C device
    lan           Configure LAN Channels
                  # 配置网络(lan)信道(channel)
    chassis       Get chassis status and set power state
                  # 查看底盘的状态和设置电源
    power         Shortcut to chassis power commands
    event         Send pre-defined events to MC
                  # 向BMC发送一个已经定义的事件(event),可用于测试配置的SNMP是否成功
    mc            Management Controller status and global enables
                  #  查看MC(Management Contollor)状态和各种允许的项
    sdr           Print Sensor Data Repository entries and readings
                  # 打印传感器仓库中的所有监控项和从传感器读取到的值。
    sensor        Print detailed sensor information
                  # 打印详细的传感器信息。
    fru           Print built-in FRU and scan SDR for FRU locators
                  # 打印内建的Field Replaceable Unit (FRU)信息
    gendev        Read/Write Device associated with Generic Device locators sdr
    sel           Print System Event Log (SEL)
                  # 打印 System Event Log (SEL)
    pef           Configure Platform Event Filtering (PEF)
                  #  设置 Platform Event Filtering (PEF),事件过滤平台用于在监控系统发现有event时候,用PEF中的策略进行 
                     事件过滤,然后看是否需要报警。
    sol           Configure and connect IPMIv2.0 Serial-over-LAN
                  # 用于配置通过串口的Lan进行监控
    tsol          Configure and connect with Tyan IPMIv1.5 Serial-over-LAN
    isol          Configure IPMIv1.5 Serial-over-LAN
    user          Configure Management Controller users
                  # 设置BMC中用户的信息 。
    channel       Configure Management Controller channels
                  # 设置Management Controller信道。
    session       Print session information
    dcmi          Data Center Management Interface
    nm            Node Manager Interface
    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
    firewall      Configure Firmware Firewall
    delloem       OEM Commands for Dell systems
    shell         Launch interactive IPMI shell
    exec          Run list of commands from file
    set           Set runtime variable for shell and exec
    hpm           Update HPM components using PICMG HPM.1 file
    ekanalyzer    run FRU-Ekeying analyzer using FRU files
    ime           Update Intel Manageability Engine Firmware
    vita          Run a VITA 46.11 extended cmd
    lan6          Configure IPv6 LAN Channels
代码语言:javascript复制
</br>



## 常用操作

### 远程电源控制类

[root@remote-jump ~]# Ipmitool -I lanplus –H 192.168.3.11 –U username –P Password chassis power off [root@remote-jump ~]# Ipmitool -I lanplus –H 192.168.3.11 –U username –P Password chassis power on [root@remote-jump ~]# Ipmitool -I lanplus –H 192.168.3.11 –U username –P Password chassis power reset [root@remote-jump ~]# Ipmitool -I lanplus –H 192.168.3.11 –U username –P Password chassis power cycle

代码语言:javascript复制
</br>
### 读取系统状态类

[root@remote-jump ~]# Ipmitool sensor list  显示系统所有传感器列表 [root@remote-jump ~]# Ipmitool fru list   显示系统所有现场可替代器件的列表 [root@remote-jump ~]# Ipmitool sdr list   显示系统所有SDRRepository设备列表  [root@remote-jump ~]# Ipmitool pef list   显示系统平台时间过滤的列表

代码语言:javascript复制
</br>
### 系统日志类

[root@remote-jump ~]# Ipmitool sel elist   显示所有系统事件日志 [root@remote-jump ~]# Ipmitool sel clear   删除所有系统时间日志 [root@remote-jump ~]# Ipmitool sel delete ID 删除第ID条SEL [root@remote-jump ~]# Ipmitool sel time get  显示当前BMC的时间 [root@remote-jump ~]# Ipmitool sel time set XXX 设置当前BMC的时间

代码语言:javascript复制
</br>
### 启动设置类

[root@remote-jump ~]# Ipmitool chassis bootdev bios 重启后停在BIOS 菜单 [root@remote-jump ~]# Ipmitool chassis bootdev pxe 重启后从PXE启动

系统相关的命令

[root@remote-jump ~]# Ipmitool mc info 显示BMC版本信息 [root@remote-jump ~]# Ipmitool bmc reset cold BMC 热启动 [root@remote-jump ~]# Ipmitool bmc reset warmBMC冷启动

代码语言:javascript复制
</br>

### 网络接口相关命令

[root@remote-jump ~]# Ipmitool lan print 1 显示channel1的网络配置信息 [root@remote-jump ~]# Ipmitool lan set 1 ipaddr 192.168.3.11 设置channel1的IP地址 [root@remote-jump ~]# Ipmitool lan set 1 netmask 255.255.0.0 设置channel1的netmask [root@remote-jump ~]# Ipmitool lan set 4 defgw ipaddr255.255.0.254 设置channel4的网关 [root@remote-jump ~]# Ipmitool lan set 2 defgw macaddr  设置channel2的网关mac address [root@remote-jump ~]# Ipmitool lan set 2 ipsrc dhcp 设置channel2的ip 源在DHCP [root@remote-jump ~]# Ipmitool lan set 3 ipsrc static 设置channel2的ip是静态获得的

代码语言:javascript复制
</br>
### 通道相关命令

[root@remote-jump ~]# Ipmitool channel info 显示系统默认channel [root@remote-jump ~]# Ipmitool channel authcap channel-number privilege  修改通道的优先级别 [root@remote-jump ~]# Ipmitool channel getaccess channel-number user-id 读取用户在通道上的权限 [root@remote-jump ~]# Ipmitool channel setacccess channel-number user-id callin=on ipmi=on link=onprivilege=5 // 设置用户在通道上的权限

代码语言:javascript复制
</br>
### 用户管理相关命令

[root@remote-jump ~]# Ipmitool user list chan-id 显示某通道上的所有用户 [root@remote-jump ~]# Ipmitool set password [] 修改某用户的密码 [root@remote-jump ~]# Ipmitool disable   禁止掉某用户 [root@remote-jump ~]# ipmitool enable   使能某用户 [root@remote-jump ~]# ipmitool priv [] 修改某用户在某通道上的权限 [root@remote-jump ~]# ipmitool test <16|20>[<password]> 测试用户

代码语言:javascript复制
</br>

### 系统管理常用
#### 查看设备信息

/usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin chassis status

代码语言:javascript复制
#### 查看用户

/usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin user list

代码语言:javascript复制
#### 增加用户

/usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin user set name 3 test1 /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin user list /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin user set password 3 test1 /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin user priv 3 20 /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin user list /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U test1 -P test1 user list

代码语言:javascript复制
#### disable/enable用户

/usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin user disable 3 /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U test1 -P test1 user list /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin user enable 3 /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U test1 -P test1 user list

代码语言:javascript复制
#### 查看服务器当前开电状态

/usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin power status

代码语言:javascript复制
#### 服务器的开机,关机,reset和power cycle

/usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin power on /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin power off /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin power cycle /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin power reset

代码语言:javascript复制
#### 查看服务器的80 Port当前状态

/usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin raw 0x30 0xB2

代码语言:javascript复制
#### 查看服务器的传感器状态

所有传感器状态详细信息: /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin sensor 传感器SDR summary信息: /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin sdr info 传感器SDR 列表信息: /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin sdr list FRU传感器SDR 列表信息: /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin sdr list fru 下载RAW SDR信息到文件: /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin sdr dump sdr.raw

代码语言:javascript复制
#### 查看服务器的FRU信息

/usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin fru /usr/bin/ipmitool -I lanplus -H 192.168.3.11 -U sysadmin -P admin fru print

0 人点赞