【硬件相关】服务器IPMI管理
一、软件安装
1、源码安装
wget https://downloads.sourceforge.net/project/ipmitool/ipmitool/1.8.18/ipmitool-1.8.18.tar.bz2
tar -jxf ipmitool-1.8.18.tar.bz2
cd ipmitool-1.8.18
./configure --prefix=/usr/local/ipmitool
make && make install
ln -s /usr/local/ipmitool/bin/ipmitool /usr/bin/ipmitool
2、在线安装
- Ubuntu
apt -y install ipmitool
- CentOS
yum -y install ipmitool
二、常用操作
1、操作服务器
- 获取服务器状态:
ipmitool -I lanplus -H {bmc-ip} -U {bmc-user} -P {bmc-password} power status
- 远程开启服务器:
ipmitool -I lanplus -H {bmc-ip} -U {bmc-user} -P {bmc-password} power on
- 远程关闭服务器:
ipmitool -I lanplus -H {bmc-ip} -U {bmc-user} -P {bmc-password} power off
2、设置BMC网络
- 查看BMC网络信息(通常配置通道1):
ipmitool lan print 1
- 设置通道1使用静态IP地址:
ipmitool lan print 1
- 设置BMC使用IP地址:
ipmitool lan set 1 ipaddr 172.16.21.98
- 设置BMC使用子网掩码:
ipmitool lan set 1 netmask 255.255.255.0
- 设置BMC使用网关:
ipmitool lan set 1 defgw ipaddr 172.16.21.205
3、设置BMC用户
- 查看BMC用户信息:
ipmitool user list 1
- 设置BMC用户密码:
ipmitool user set password {bmc-user-id} {bmc-password}
4、功率统计
参考链接:How can I view power consumption through IPMItool on X10 boards?
- 获取方式1(适用于supermicro主板):
服务器本机执行ipmitool dcmi power reading
命令,查看瞬时功率情况(Instantaneous power reading)
注:可以30秒采集一次样本,取瞬时功率情况,共采集60次,取60次平均值,即为该服务器平均运行功率
[root@node85 ~]# dmidecode -t1
# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 3.2.1 present.
# SMBIOS implementations newer than version 3.1.1 are not
# fully supported by this version of dmidecode.
Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: Supermicro
Product Name: Super Server
Version: 0123456789
Serial Number: 0123456789
UUID: a24b6000-3fa3-11eb-8000-ac1f6beba81e
Wake-up Type: Power Switch
SKU Number: To be filled by O.E.M.
Family: To be filled by O.E.M.
[root@node85 ~]# ipmitool dcmi power reading
Instantaneous power reading: 290 Watts
Minimum during sampling period: 196 Watts
Maximum during sampling period: 498 Watts
Average power reading over sample period: 272 Watts
IPMI timestamp: Mon Nov 14 08:27:39 2022
Sampling period: 00388554 Seconds.
Power reading state is: activated
- 获取方式2:
a、任意客户端执行ipmitool -H {bmc-ip} -I lanplus -U {bmc-user} -P {bmc-password} sdr elist | grep "PW Consumption"
b、服务器本机执行ipmitool sdr list | grep "PW Consumption"
[root@node41 ~]# ipmitool -H 172.16.21.99 -I lanplus -U ADMIN -P ADMIN sdr elist | grep "PW Consumption"
PW Consumption | 1Ah | ok | 21.0 | 278 Watts