前言
我们知道IPMI很强大,如何利用ipmitool获取到电源的实施状态的。现代的服务器,基本上都有两个电源模块,作为冗余。如何查看电源的状态信息呢,是否所有的电源模块都已启用,电源是否都通电?
方法一
通过如下指令可以获取到电源的状态信息:
ipmitool sdr type "power supply"
正常情况下电源的状态如下所示:
PS1 Status | C4h | ok | 10.1 | Presence detected
PS2 Status | C5h | ok | 10.2 | Presence detected
如果,我们将其中一个拔掉电源插头,状态就会如下所示:
PS1 Status | C4h | ok | 10.1 | Presence detected
PS2 Status | C5h | ok | 10.2 | Presence detected, Failure detected, Power Supply AC lost
如果我们将其中一个的电源模块(PSU, power supply unit)直接从服务器上拔出,状态就会如下所示:
PS1 Status | C4h | ok | 10.1 | Presence detected
PS2 Status | C5h | ok | 10.2 |
事实上除了上面的几种,我们可以通过
ipmitool sensor get "PS1 Status"
查看其他可能的值:
Sensor ID : PS1 Status (0xc4)
Entity ID : 10.1 (Power Supply)
Sensor Type (Discrete): Power Supply (0x08)
Sensor Reading : 1h <-------------这个值是方法2提到0x01 ,即正常状态
Event Message Control : Per-threshold
States Asserted : Power Supply
[Presence detected]
Assertion Events : Power Supply
[Presence detected]
Deassertion Events : Power Supply
[Failure detected]
Assertions Enabled : Power Supply
[Failure detected]
[Power Supply AC lost]
[AC lost or out-of-range]
[AC out-of-range, but present]
[Config Error]
Deassertions Enabled : Power Supply
[Failure detected]
[Power Supply AC lost]
[AC lost or out-of-range]
[AC out-of-range, but present]
[Config Error]
OEM : 0
方法二
从如下指令也可以获得电源模块的信息:
ipmitool sensor list
输出如下:
PS1 Status | 0x1 | discrete | 0x0100| na | na | na | na | na | na
PS2 Status | 0x1 | discrete | 0x0100| na | na | na | na | na | na
第二列的值很有意思:
- 0x01 status ok,最常见的状态
- 0x00 power supply unit not present ,即电源模块不存在,一般电源模块从服务器中拔出,状态是0x00
- 0x03 power supply off or failed,我没有遇到过这种状态,我猜是电源模块坏了的时候,会是这种状态
- 0x0b input out of range(ex. No AC input)这也是很常见的状态,把电源的插头拔掉,就会是这种状态。
这种方法比较好,个人比较推荐这种方法。
参考文献
- https://support.hpe.com/hpsc/doc/public/display?docId=emr_na-sg8039en_us&docLocale=en_US