0

这是 的输出$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     

关于内存信息,我知道DIMMA1,A2和B2没有被插件,DIMMB1的温度是36.0度。

这是ipmimonitoring-sensorsFreeIPMI 的输出:

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 插槽呢?

4

1 回答 1

0

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

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

根据您在标题中关于 API 的问题,在 libipmimonitoring API 中,关键标志是 IPMI_MONITORING_SENSOR_READING_FLAGS_IGNORE_NON_INTERPRETABLE_SENSORS。在示例代码中查找它,您可能会看到该怎么做。

于 2017-06-10T09:04:56.650 回答