title: Get all DIMM information from IPMI using FreeIPMI API
body: <p>Here is the output from <code>$ipmitool -sensor</code>, they show all DIMM info. But FreeIPMI only have the DIMM info that have been plug-in. How can I get all Memory DIMM information by using FreeIPMI API in C? </p>
  
  <pre><code>$ 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     
  </code></pre>
  
  <p>About the Memory information, I know that DIMMA1, A2 and B2 are not been plug-in, and DIMMB1 is 36.0 degree in Temperature.</p>
  
  <p>And here is the output from <code>ipmimonitoring-sensors</code> of FreeIPMI:</p>
  
  <pre><code>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'
  </code></pre>
  
  <p>But no information for the DIMMA1, A2 and B2, because they are not plug-in. So I trace the code of impi-monitoring-sensor.c</p>
  
  <pre><code>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)) &lt; 0)
  </code></pre>
  
  <p>and the config</p>
  
  <pre><code>static void
  _init_ipmi_config (struct ipmi_monitoring_ipmi_config *ipmi_config)
  {
    assert (ipmi_config);
  
    ipmi_config-&gt;driver_type = driver_type;
    ipmi_config-&gt;disable_auto_probe = disable_auto_probe;
    ipmi_config-&gt;driver_address = driver_address;
    ipmi_config-&gt;register_spacing = register_spacing;
    ipmi_config-&gt;driver_device = driver_device;
  
    ipmi_config-&gt;protocol_version = protocol_version;
    ipmi_config-&gt;username = username;
    ipmi_config-&gt;password = password;
    ipmi_config-&gt;k_g = k_g;
    ipmi_config-&gt;k_g_len = k_g_len;
    ipmi_config-&gt;privilege_level = privilege_level;
    ipmi_config-&gt;authentication_type = authentication_type;
    ipmi_config-&gt;cipher_suite_id = cipher_suite_id;
    ipmi_config-&gt;session_timeout_len = session_timeout;
    ipmi_config-&gt;retransmission_timeout_len = retransmission_timeout;
  
    ipmi_config-&gt;workaround_flags = workaround_flags;
  }
  </code></pre>
  
  <p>I can assume the motherboard has 4 DIMM slot, and if they are not found in the FreeIPMI sensor output, I can guess they are not been plug-in. But how do I know the all DIMM slot in the motherboard by IPMI command?</p>