ipmptool 使用原始命令获取主板序列号

ipmptool 使用原始命令获取主板序列号

我想用来ipmitool获取主板序列号,目前我可以用来$ sudo ipmitool fru查询以下信息:

$ sudo ipmitool fru
FRU Device Description : Builtin FRU Device (ID 0)
 Chassis Type          : Main Server Chassis
 Chassis Part Number   : 01234567
 Chassis Serial        : 01234567890123456789AB
 Board Mfg Date        : Wed Jan  7 13:07:00 2015
 Board Mfg             : GIGABYTE
 Board Product         : MB10-DS4
 Board Serial          : GG3P8800012
 Board Part Number     : 01234567
 Product Manufacturer  : GIGABYTE
 Product Name          : MB10-DS4
 Product Part Number   : 000000000001
 Product Version       : 0100
 Product Serial        : 01234567890123456789AB
 Product Asset Tag     : 01234567890123456789AB

因为在我的项目中,我需要在 C 代码中使用 OpenIPMI API 来获取 Board Serial,所以我认为这应该是唯一的。因此,我使用 raw 命令:

$ sudo ipmitool raw
Not enough parameters given.
RAW Commands:  raw <netfn> <cmd> [data]

Network Function Codes:

  VAL   HEX     STRING
==============================================
  0     0x00    Chassis
  2     0x02    Bridge
  4     0x04    SensorEvent
  6     0x06    Application
  8     0x08    Firmware
  10    0x0a    Storage
  12    0x0c    Transport

(can also use raw hex values)

然后,尝试发出以下命令来了解有关原始命令格式的更多信息

$ sudo ipmitool raw 0 0
 01 20 20 20 20 20
$ sudo ipmitool raw 0 1
 21 00 00 70
$ sudo ipmitool raw 0 2
Unable to send RAW command (channel=0x0 netfn=0x0 lun=0x0 cmd=0x2 rsp=0xc7): 
Request data length invalid

我已经在Google上搜索了好几天,但找不到任何信息,并且我已经下载了ipmitool的源代码,也许我会尝试更清楚地阅读源代码。

顺便说一句,我已经从 SuperMicro 下载了 IPMI 实用程序“IPMICFG”,并按照指南Supermicro IPMI 设备配置使用 IPMICFG,并读取OpenIPMI 简介

我的问题是,我应该使用什么netfn代码,获取 Board Serial 的命令是什么,在这种情况下,值应该是GG3P8800012

有什么建议吗?

提前致谢。


谢谢@Lenniey

以下是输出sudo ipmitool fru -vvv

$ sudo ipmitool fru -vvv
Using ipmi device 0
Set IPMB address to 0x20
OpenIPMI Request Message Header:
  netfn     = 0x6
  cmd       = 0x1
Iana: 15370
Running Get PICMG Properties my_addr 0x20, transit 0, target 0
OpenIPMI Request Message Header:
  netfn     = 0x2c
  cmd       = 0x0
OpenIPMI Request Message Data (1 bytes)
 00
Error response 0xc1 from Get PICMG Properities
Running Get VSO Capabilities my_addr 0x20, transit 0, target 0
OpenIPMI Request Message Header:
  netfn     = 0x2c
  cmd       = 0x0
OpenIPMI Request Message Data (1 bytes)
 03
Invalid completion code received: Invalid command
Acquire IPMB address
Discovered IPMB address 0x0
Interface address: my_addr 0x20 transit 0:0 target 0x20:0 ipmb_target 0

FRU Device Description : Builtin FRU Device (ID 0)
OpenIPMI Request Message Header:
  netfn     = 0x6
  cmd       = 0x1
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x10
OpenIPMI Request Message Data (1 bytes)
 00
fru.size = 2048 bytes (accessed by bytes)
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 00 00 08
 FRU DATA (9 bytes)
 08 01 00 01 07 0e 00 00 e9
fru.header.version:         0x1
fru.header.offset.internal: 0x0
fru.header.offset.chassis:  0x8
fru.header.offset.board:    0x38
fru.header.offset.product:  0x70
fru.header.offset.multi:    0x0
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 08 00 02
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 08 00 21
Retrying FRU read with request size 25
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 08 00 19
Retrying FRU read with request size 24
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 08 00 18
Retrying FRU read with request size 23
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 08 00 17
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 1f 00 17
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 36 00 02
 Chassis Type          : Main Server Chassis
 Chassis Part Number   : 01234567
 Chassis Serial        : 01234567890123456789AB
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 38 00 02
OpenIPMI Request Message Header:
  netfn     = 0xa
   cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 38 00 17
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 4f 00 17
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 66 00 0a
 Board Mfg Date        : Wed Jan  7 13:07:00 2015
 Board Mfg             : GIGABYTE
 Board Product         : MB10-DS4
 Board Serial          : GG3P8800012
 Board Part Number     : 01234567
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 70 00 02
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 70 00 17
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 87 00 17
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 9e 00 17
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 b5 00 17
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x11
OpenIPMI Request Message Data (4 bytes)
 00 cc 00 04
 Product Manufacturer  : GIGABYTE
 Product Name          : MB10-DS4
 Product Part Number   : 000000000001
 Product Version       : 0100
 Product Serial        : 01234567890123456789AB
 Product Asset Tag     : 01234567890123456789AB

OpenIPMI Request Message Header:
  netfn     = 0x6
  cmd       = 0x1
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x20
SDR free space: 14864
SDR records   : 25
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x22
SDR reservation ID 0002
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 00 00 00 05
SDR record ID   : 0x0000
SDR record id mismatch: 0x0001
SDR record type : 0x12
SDR record next : 0x0002
SDR record bytes: 16
Getting 16 bytes from SDR at offset 5
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 00 00 05 10
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 02 00 00 05
SDR record ID   : 0x0002
SDR record type : 0xc0
SDR record next : 0x0003
SDR record bytes: 11
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 03 00 00 05
SDR record ID   : 0x0003
SDR record type : 0x01
SDR record next : 0x0009
SDR record bytes: 52
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 09 00 00 05
SDR record ID   : 0x0009
SDR record type : 0x01
SDR record next : 0x000a
SDR record bytes: 53
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 0a 00 00 05
SDR record ID   : 0x000a
SDR record type : 0x01
SDR record next : 0x000c
SDR record bytes: 53
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 0c 00 00 05
SDR record ID   : 0x000c
SDR record type : 0x01
SDR record next : 0x000d
SDR record bytes: 53
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 0d 00 00 05
SDR record ID   : 0x000d
SDR record type : 0x01
SDR record next : 0x003b
SDR record bytes: 53
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 3b 00 00 05
SDR record ID   : 0x003b
SDR record type : 0x01
SDR record next : 0x003c
SDR record bytes: 47
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 3c 00 00 05
SDR record ID   : 0x003c
SDR record type : 0x01
SDR record next : 0x003d
SDR record bytes: 46
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 3d 00 00 05
SDR record ID   : 0x003d
SDR record type : 0x01
SDR record next : 0x003e
SDR record bytes: 47
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 3e 00 00 05
SDR record ID   : 0x003e
SDR record type : 0x01
SDR record next : 0x0040
SDR record bytes: 51
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 40 00 00 05
SDR record ID   : 0x0040
SDR record type : 0x01
SDR record next : 0x0041
SDR record bytes: 49
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 41 00 00 05
SDR record ID   : 0x0041
SDR record type : 0x01
SDR record next : 0x0043
SDR record bytes: 53
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 43 00 00 05
SDR record ID   : 0x0043
SDR record type : 0x01
SDR record next : 0x0047
SDR record bytes: 52
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 47 00 00 05
SDR record ID   : 0x0047
SDR record type : 0x01
SDR record next : 0x0048
SDR record bytes: 53
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 48 00 00 05
SDR record ID   : 0x0048
SDR record type : 0x01
SDR record next : 0x0049
SDR record bytes: 52
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 49 00 00 05
SDR record ID   : 0x0049
SDR record type : 0x01
SDR record next : 0x004a
SDR record bytes: 57
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 4a 00 00 05
SDR record ID   : 0x004a
SDR record type : 0x01
SDR record next : 0x0088
SDR record bytes: 56
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 88 00 00 05
SDR record ID   : 0x0088
SDR record type : 0x01
SDR record next : 0x008a
SDR record bytes: 51
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 8a 00 00 05
SDR record ID   : 0x008a
SDR record type : 0x01
SDR record next : 0x00b9
SDR record bytes: 51
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 b9 00 00 05
SDR record ID   : 0x00b9
SDR record type : 0x02
SDR record next : 0x00ba
SDR record bytes: 31
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 ba 00 00 05
SDR record ID   : 0x00ba
SDR record type : 0x02
SDR record next : 0x00bd
SDR record bytes: 31
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 bd 00 00 05
SDR record ID   : 0x00bd
SDR record type : 0x02
SDR record next : 0x00ca
SDR record bytes: 36
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 ca 00 00 05
SDR record ID   : 0x00ca
SDR record type : 0x01
SDR record next : 0x00cd
SDR record bytes: 51
OpenIPMI Request Message Header:
  netfn     = 0xa
  cmd       = 0x23
OpenIPMI Request Message Data (6 bytes)
 02 00 cd 00 00 05
SDR record ID   : 0x00cd
SDR record type : 0x02
SDR record next : 0xffff
SDR record bytes: 30

按照@Lenniey 的建议,我发出以下命令:

$ sudo ipmitool -v raw 0xa 0x11
Running Get PICMG Properties my_addr 0x20, transit 0, target 0
Error response 0xc1 from Get PICMG Properities
Running Get VSO Capabilities my_addr 0x20, transit 0, target 0
Invalid completion code received: Invalid command
Discovered IPMB address 0x0
RAW REQ (channel=0x0 netfn=0xa lun=0x0 cmd=0x11 data_len=0)
Unable to send RAW command (channel=0x0 netfn=0xa lun=0x0 cmd=0x11 rsp=0xc7): 
Request data length invalid

这里又引出另一个问题:如何从输出中获取原始命令线索sudo ipmitool fru -vvv

答案1

要读取 FRU,您需要使用以下命令:

ipmitool raw 0xa 0x11 <offset lsb> <offset msb> <count>

您将需要计算电路板串行的偏移量,但您可以通过反复试验(或实际进行计算)来完成。

响应将是

  • 第一个字节:读取的字节数。
  • 第二个字节及以后:读取的原始数据。

相关内容