gpt4 book ai didi

c - 使用 FreeIPMI API 从 IPMI 获取所有 DIMM 信息

转载 作者:太空宇宙 更新时间:2023-11-04 12:27:08 28 4
gpt4 key购买 nike

这是 $ipmitool -sensor 的输出,它们显示所有 DIMM 信息。但是FreeIPMI只有插件的DIMM信息。如何在 C 中使用 FreeIPMI API 获取所有内存 DIMM 信息?

$ sudo ipmitool sensor
CPU Temp | 59.000 | degrees C | ok | 0.000 | 0.000 | 0.000 | 99.000 | 104.000 | 104.000
System Temp | 35.000 | degrees C | ok | -10.000 | -5.000 | 0.000 | 80.000 | 85.000 | 90.000
Peripheral Temp | 49.000 | degrees C | ok | -10.000 | -5.000 | 0.000 | 80.000 | 85.000 | 90.000
DIMMA1 Temp | na | | na | na | na | na | na | na | na
DIMMA2 Temp | na | | na | na | na | na | na | na | na
DIMMB1 Temp | 36.000 | degrees C | ok | -5.000 | 0.000 | 5.000 | 80.000 | 85.000 | 90.000
DIMMB2 Temp | na | | na | na | na | na | na | na | na
FAN1 | 3800.000 | RPM | ok | 300.000 | 500.000 | 700.000 | 25300.000 | 25400.000 | 25500.000
FAN2 | 4100.000 | RPM | ok | 300.000 | 500.000 | 700.000 | 25300.000 | 25400.000 | 25500.000
FAN3 | 4100.000 | RPM | ok | 300.000 | 500.000 | 700.000 | 25300.000 | 25400.000 | 25500.000
FANA | 4400.000 | RPM | ok | 300.000 | 500.000 | 700.000 | 25300.000 | 25400.000 | 25500.000
12V | 12.000 | Volts | ok | 10.173 | 10.299 | 10.740 | 12.945 | 13.260 | 13.386
5VCC | 4.922 | Volts | ok | 4.246 | 4.298 | 4.480 | 5.390 | 5.546 | 5.598
3.3VCC | 3.248 | Volts | ok | 2.789 | 2.823 | 2.959 | 3.554 | 3.656 | 3.690
VBAT | 3.047 | Volts | ok | 2.375 | 2.487 | 2.599 | 3.775 | 3.887 | 3.999
Vcpu | 1.809 | Volts | ok | 1.242 | 1.260 | 1.395 | 1.899 | 2.088 | 2.106
VDIMMAB | 1.191 | Volts | ok | 0.948 | 0.975 | 1.047 | 1.344 | 1.425 | 1.443
VDIMMCD | 1.209 | Volts | ok | 0.948 | 0.975 | 1.047 | 1.344 | 1.425 | 1.443
5VSB | 4.974 | Volts | ok | 4.246 | 4.298 | 4.480 | 5.390 | 5.546 | 5.598
3.3VSB | 3.197 | Volts | ok | 2.789 | 2.823 | 2.959 | 3.554 | 3.656 | 3.690
1.5V PCH | 1.509 | Volts | ok | 1.320 | 1.347 | 1.401 | 1.644 | 1.671 | 1.698
1.2V BMC | 1.218 | Volts | ok | 1.020 | 1.047 | 1.092 | 1.344 | 1.371 | 1.398
1.05V PCH | 1.041 | Volts | ok | 0.870 | 0.897 | 0.942 | 1.194 | 1.221 | 1.248
Chassis Intru | 0x0 | discrete | 0x0000| na | na | na | na | na | na

关于Memory的信息,我知道DIMMA1,A2,B2都没有插上,DIMMB1的Temperature是36.0度。

下面是 FreeIPMI 的 ipmimonitoring-sensors 的输出:

Record ID, Sensor Name, Sensor Number, Sensor Type, Sensor State, Sensor Reading, Sensor Units, Sensor Event/Reading Type Code, Sensor Event Bitmask, Sensor Event String
4, Processor 1 CPU Temp, 1, Temperature, Nominal, 60.00, C, 1h, C0h, 'OK'
71, System Board 1 System Temp, 11, Temperature, Nominal, 36.00, C, 1h, C0h, 'OK'
138, System Board 2 Peripheral Temp, 14, Temperature, Nominal, 50.00, C, 1h, C0h, 'OK'
339, Memory Device 68 DIMMB1 Temp, 180, Temperature, Nominal, 37.00, C, 1h, C0h, 'OK'
473, Fan 1 FAN1, 65, Fan, Nominal, 3800.00, RPM, 1h, C0h, 'OK'
540, Fan 2 FAN2, 66, Fan, Nominal, 4100.00, RPM, 1h, C0h, 'OK'
607, Fan 3 FAN3, 67, Fan, Nominal, 4000.00, RPM, 1h, C0h, 'OK'
674, Fan 5 FANA, 69, Fan, Nominal, 4300.00, RPM, 1h, C0h, 'OK'
741, System Board 17 12V, 48, Voltage, Nominal, 12.00, V, 1h, C0h, 'OK'
808, System Board 33 5VCC, 49, Voltage, Nominal, 4.92, V, 1h, C0h, 'OK'
875, System Board 32 3.3VCC, 50, Voltage, Nominal, 3.25, V, 1h, C0h, 'OK'
942, System Board 18 VBAT, 51, Voltage, Nominal, 3.05, V, 1h, C0h, 'OK'
1009, Processor 2 Vcpu, 52, Voltage, Nominal, 1.81, V, 1h, C0h, 'OK'
1076, Memory Device 1 VDIMMAB, 53, Voltage, Nominal, 1.19, V, 1h, C0h, 'OK'
1143, Memory Device 2 VDIMMCD, 55, Voltage, Nominal, 1.21, V, 1h, C0h, 'OK'
1210, System Board 15 5VSB, 56, Voltage, Nominal, 4.97, V, 1h, C0h, 'OK'
1277, System Board 16 3.3VSB, 57, Voltage, Nominal, 3.20, V, 1h, C0h, 'OK'
1344, System Board 19 1.5V PCH, 60, Voltage, Nominal, 1.51, V, 1h, C0h, 'OK'
1411, System Board 20 1.2V BMC, 61, Voltage, Nominal, 1.22, V, 1h, C0h, 'OK'
1478, System Board 21 1.05V PCH, 62, Voltage, Nominal, 1.04, V, 1h, C0h, 'OK'
1545, System Chassis Chassis Intru, 170, Physical Security, Nominal, N/A, N/A, 6Fh, 0h, 'OK'

但是没有DIMMA1、A2、B2的信息,因为它们不是插件。所以我跟踪impi-monitoring-sensor.c的代码

if ((sensor_count = ipmi_monitoring_sensor_readings_by_record_id (ctx,
hostname,
ipmi_config,
sensor_reading_flags,
NULL, /* record_ids */
0, /* record_ids_length */
NULL,
NULL)) < 0)

和配置

static void
_init_ipmi_config (struct ipmi_monitoring_ipmi_config *ipmi_config)
{
assert (ipmi_config);

ipmi_config->driver_type = driver_type;
ipmi_config->disable_auto_probe = disable_auto_probe;
ipmi_config->driver_address = driver_address;
ipmi_config->register_spacing = register_spacing;
ipmi_config->driver_device = driver_device;

ipmi_config->protocol_version = protocol_version;
ipmi_config->username = username;
ipmi_config->password = password;
ipmi_config->k_g = k_g;
ipmi_config->k_g_len = k_g_len;
ipmi_config->privilege_level = privilege_level;
ipmi_config->authentication_type = authentication_type;
ipmi_config->cipher_suite_id = cipher_suite_id;
ipmi_config->session_timeout_len = session_timeout;
ipmi_config->retransmission_timeout_len = retransmission_timeout;

ipmi_config->workaround_flags = workaround_flags;
}

我可以假设主板有 4 个 DIMM 插槽,如果在 FreeIPMI 传感器输出中没有找到它们,我可以猜测它们没有被插入。但是如何通过IPMI命令知道主板上所有的DIMM插槽呢?

最佳答案

这里是 FreeIPMI 维护者。一般来说,如果传感器“不可用”,FreeIPMI 中的大多数工具将不会输出有关传感器的信息。 (在内部,这映射到我不会详细说明的各种事物。)似乎 ipmitool 默认输出一些传感器信息,而不管可用性如何。

根据您关于使用 IPMI 命令的问题。使用 FreeIPMI 的 ipmi-sensors,您可以使用 -v(或可能的 -vv)查看剩余的 DIMM。

根据标题中有关 API 的问题,在 libipmimonitoring API 中,关键标志是 IPMI_MONITORING_SENSOR_READING_FLAGS_IGNORE_NON_INTERPRETABLE_SENSORS。在示例代码中查找它,您可能会知道要做什么。

关于c - 使用 FreeIPMI API 从 IPMI 获取所有 DIMM 信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44296332/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com