Я бы хотел использовать 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
Поскольку в моем проекте мне нужно использовать OpenIPMI API в коде C, чтобы получить Board Serial, я думаю, что это должно быть уникальным. Итак, я использую необработанную команду:
$ 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
Я гуглил несколько дней, но не могу найти никакой информации, и я скачал исходный код ipmitool, может быть, я попробую более четко прочитать исходный код.
Кстати, я загрузил утилиту IPMI IPMICFG из SuperMicro и следую руководству Конфигурация устройства Supermicro IPMI используя IPMICFG, и прочтите Мягкое введение в OpenIPMI.
Мой вопрос, что это за netfn
код, который я должен использовать, и какая команда для получения серийного номера платы, в этом случае значение должно быть 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
?
Чтобы прочитать FRU, вам нужно использовать следующую команду:
ipmitool raw 0xa 0x11 <offset lsb> <offset msb> <count>
Вам нужно будет рассчитать смещение серийного номера платы, но это можно сделать с помощью проб и ошибок (или на самом деле вычислить).
Ответ будет