1

IPMI 使用

 1 year ago
source link: http://abcdxyzk.github.io/blog/2022/08/15/ipmi/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

IPMI 使用

2022-08-15 20:58:00

https://www.cnblogs.com/machangwei-8/p/10350824.html

yum install -y ipmitool

一、开关机,重启

1. 查看开关机状态: ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 power status
2. 开机: ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 power on
3. 关机: ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 power off
4. 重启: ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 power reset

二、SOL功能

1. 设置SOL串口波特率: ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 sol set volatile-bit-rate <9.6/19.2/38.4/57.6/115.2>
说明: <9.6/19.2/38.4/57.6/115.2>其中115.2代表115200,即`*1000`是表示的波特率。

2. 打开SOL功能: ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 sol activate
3. 关闭SOL功能: ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 sol deactivate

三、IP网络设置

换网段需要用web界面改,因为IP,GateWay 不能一条命令完成

1. 查看网络信息:       ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 lan print [ChannelNo]
2. 修改IP为静态还是DHCP模式: ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 lan set <ChannelNo> ipsrc <static/dhcp>
3. 修改IP地址:            ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 lan set <ChannelNo> ipaddr <IPAddress>
4. 修改子网掩码:        ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 lan set <ChannelNo> netmask <NetMask>
5. 修改默认网关:        ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 lan set <ChannelNo> defgw ipaddr <默认网关>

说明: [ChannelNo] 字段是可选的, ChannoNo为1(Share Nic网络)或者8 (BMC独立管理网络)
设置网络参数,必须首先设置IP为静态,然后再进行其他设置;

四、用户管理

1. 查看用户信息:   ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 user list [ChannelNo]
2. 增加用户:      ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 user set name <user id> <username>
3. 设置密码:      ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 user set password <user id> <password>
4. 设置用户权限:    ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 user priv <user id> <privilege level> [ChannelNo]
5. 启用/禁用用户:   ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 user enable/disable <user id>

说明: [ChannelNo] 字段是可选的,ChannoNo为1或者8;
BMC默认有2个用户: user id为1的匿名用户,user id为2的ADMIN用户;
privilege level: 2为user权限,3为Operator权限,4为Administrator权限;

五、SEL日志查看

1. 查看SEL日志: ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 sel list

六、FRU信息查看

1. 查看FRU信息: ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 fru list

七、SDR,Sensor信息查看

1. 查看SDR Sensor信息:   ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 sdr
2. 查看Sensor信息:    ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 sensor list

八、mc(管理单元BMC)状态和控制

1. 重启动BMC: ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 mc reset <warm/cold>

九、设置BMC的iptables防火墙

1. 设置某一段IP可以访问BMC
ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 raw 0x32 0x76 0x01 0x01 ip1(0xa 0xa 0xa 0xa) ip2(0xb 0xb 0xb 0xb)
ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 raw 0x32 0x76 0x09

2. 设置某个IP可以访问BMC
ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 raw 0x32 0x76 0x00 0x01 ip1(0xa 0xa 0xa 0xa)
ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 raw 0x32 0x76 0x09

3. 取消设置: ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 raw 0x32 0x76 0x08

4.获取防火墙设置: ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 raw 0x32 0x77 0x01 0x00

5. 阻止/开启某个端口: ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 raw 0x32 0x76 0x02 0x00/0x01 0x00 (portno)0x22 0x00

6. 取消某个端口的设置(6是5的对应取消操作): ipmitool -H IP地址 -I lanplus -U 用户名 -P 密码 raw 0x32 0x76 0x06 0x00/0x01 0x00 (portno)0x22 0x00

直接进入本地BMC sh

service ipmi start
ipmitool -I open shell

ipmitool本地监控命令:

ipmitool -I open command

其中-I open表示使用OpenIPMI接口,command有以下项: 

a) raw: 发送一个原始的IPMI请求,并且打印回复信息。
b) lan: 配置网络(lan)信道(channel)
c) chassis : 查看底盘的状态和设置电源
d) event: 向BMC发送一个已经定义的事件(event),可用于测试配置的SNMP是否成功
e) mc:  查看MC(Management Contollor)状态和各种允许的项
f) sdr: 打印传感器仓库中的所有监控项和从传感器读取到的值。
g) sensor: 打印详细的传感器信息。
h) fru: 打印内建的Field Replaceable Unit (FRU)信息
i) sel:  打印 System Event Log (SEL)
j) pef:  设置 Platform Event Filtering (PEF),事件过滤平台用于在监控系统发现有event时候,用PEF中的策略进行事件过滤,然后看是否需要报警。
k) sol/isol: 用于配置通过串口的Lan进行监控
l) user: 设置BMC中用户的信息 。
m) 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有: 
	1 Temperature: Upper Critical: Going High
	2 Voltage Threshold: Lower Critical: Going Low
	3 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 ipsrc static       (设置ipmi ip非DHCP)
ipmitool -I open lan set 1 ipaddr 192.168.0.1 (设置IPMI  地址)
ipmitool -I open lan set 1 netmask 255.255.255.0  (设置ipmi 子网掩码)
ipmitool -I open lan set 1 defgw ipaddr 192.168.0.1   (设置ipmi 网关
ipmitool -I open lan set 1 access on  设置channel 1允许访问。

ipmitool -I open lan set 1 snmp public    设置channel 1 上snmp的community为public。

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信息并显示。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK