ateodorescu / home-assistant-ipmi

IPMI connector for Home Assistant
MIT License
36 stars 8 forks source link

Sensors not available on Supermicro A2SDi-HLN4F #14

Closed janek202 closed 10 months ago

janek202 commented 10 months ago

Hello,

Thank you for this integration.

I tried integrating it with my Supermicro A2SDi-HLN4F. I can see the sensor entities, but they are not available and don't show any values.

I tried with and without the ipmi addon.

With the addon I can see error messages:

2023/09/02 15:10:10 [error] 202#202: *1 FastCGI sent in stderr: "PHP message: Error occurred when running "ipmitool -H <IPMI_IP> -p 623 -U <USER> -P <PASSWORD> -I lanplus dcmi power reading".

    DCMI request failed because: Invalid command (c1)
PHP message: Error occurred when running "ipmitool -H <IPMI_IP> -p 623 -U <USER> -P <PASSWORD> -I lan dcmi power reading".

    DCMI request failed because: Invalid command (c1)
PHP message: Error occurred when running "ipmitool -H <IPMI_IP> -p 623 -U <USER> -P <PASSWORD> -I imb dcmi power reading".
Error loading interface imb
PHP message: Error occurred when running "ipmitool -H <IPMI_IP> -p 623 -U <USER> -P <PASSWORD> -I open dcmi power reading".
Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory" while reading response header from upstream, client: <CLIENT_IP>, server: _, request: "GET /?host=<IPMI_IP>&port=623&user=<USER>&password=<PASSWORD> HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:9595"

Powering up the server seems to be working fine. My system only has a motherboard with an ATX PSU in a standard case, it does not support power monitoring.

ateodorescu commented 10 months ago

Can you read any sensors if you use ipmitool yourself?

janek202 commented 10 months ago

Yes, I can. I connected to the addon container to rule out any version incompatibilites and I can see the sensor values:

$ ipmitool -I lan -H $IP -U $USER -P $PASSWORD sensor
CPU Temp         | 43.000     | degrees C  | ok    | 0.000     | 0.000     | 0.000     | 86.000    | 91.000    | 91.000
System Temp      | 38.000     | degrees C  | ok    | -10.000   | -5.000    | 0.000     | 80.000    | 85.000    | 90.000
Peripheral Temp  | 33.000     | degrees C  | ok    | -10.000   | -5.000    | 0.000     | 80.000    | 85.000    | 90.000
DIMMA1 Temp      | 41.000     | degrees C  | ok    | -5.000    | 0.000     | 5.000     | 80.000    | 85.000    | 90.000
DIMMA2 Temp      | 39.000     | degrees C  | ok    | -5.000    | 0.000     | 5.000     | 80.000    | 85.000    | 90.000
DIMMB1 Temp      | 41.000     | degrees C  | ok    | -5.000    | 0.000     | 5.000     | 80.000    | 85.000    | 90.000
DIMMB2 Temp      | 41.000     | degrees C  | ok    | -5.000    | 0.000     | 5.000     | 80.000    | 85.000    | 90.000
FAN1             | 1000.000   | RPM        | ok    | 0.000     | 100.000   | 200.000   | 25300.000 | 25400.000 | 25500.000
FAN2             | 500.000    | RPM        | ok    | 0.000     | 100.000   | 200.000   | 25300.000 | 25400.000 | 25500.000
FAN3             | na         |            | na    | na        | na        | na        | na        | na        | na
FANA             | na         |            | na    | na        | na        | na        | na        | na        | na
12V              | 12.256     | Volts      | ok    | 10.144    | 10.272    | 10.784    | 12.960    | 13.280    | 13.408
5VCC             | 5.000      | Volts      | ok    | 4.246     | 4.298     | 4.480     | 5.390     | 5.546     | 5.598
3.3VCC           | 3.367      | Volts      | ok    | 2.789     | 2.823     | 2.959     | 3.554     | 3.656     | 3.690
VBAT             | 3.117      | Volts      | ok    | 2.392     | 2.479     | 2.595     | 3.494     | 3.581     | 3.697
Vcpu             | 1.026      | Volts      | ok    | 0.441     | 0.450     | 0.495     | 1.296     | 1.422     | 1.440
VDIMM            | 1.218      | Volts      | ok    | 0.948     | 0.975     | 1.047     | 1.344     | 1.425     | 1.443
PVCCSRAM         | 1.024      | Volts      | ok    | 0.655     | 0.664     | 0.745     | 1.195     | 1.294     | 1.303
P1V05_A          | 1.050      | Volts      | ok    | 0.870     | 0.897     | 0.942     | 1.194     | 1.221     | 1.248
5VSB             | 4.948      | Volts      | ok    | 3.960     | 4.038     | 4.350     | 5.624     | 5.936     | 6.040
3.3VSB           | 3.317      | Volts      | ok    | 2.603     | 2.671     | 2.875     | 3.708     | 3.912     | 3.980
PVNN             | 0.820      | Volts      | ok    | 0.568     | 0.568     | 0.640     | 1.225     | 1.351     | 1.360
PVPP             | 2.696      | Volts      | ok    | 2.174     | 2.228     | 2.390     | 3.092     | 3.254     | 3.308
P1V538_A         | 1.545      | 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
PVCC_REF         | 1.286      | Volts      | ok    | 1.043     | 1.097     | 1.142     | 1.394     | 1.421     | 1.448
Chassis Intru    | 0x0        | discrete   | 0x0000| na        | na        | na        | na        | na        | na

Edit: I also collected some debug logs from the integration running standalone, and I can see the values in the log, but the sensors themselves report ERR: CC=0xcb:

[custom_components.ipmi] IPMI Sensors Available: IpmiDeviceInfo(device={'manufacturer_name': '', 'product_name': '', 'firmware_revision': '...', 'product_id': ...}, power_on=True, sensors={'temperature': {'cpu_temp': 'CPU Temp', 'system_temp': 'System Temp', 'peripheral_temp': 'Peripheral Temp', 'dimma1_temp': 'DIMMA1 Temp', 'dimma2_temp': 'DIMMA2 Temp', 'dimmb1_temp': 'DIMMB1 Temp', 'dimmb2_temp': 'DIMMB2 Temp'}, 'voltage': {'12v': '12V', '5vcc': '5VCC', '33vcc': '3.3VCC', 'vbat': 'VBAT', 'vcpu': 'Vcpu', 'vdimm': 'VDIMM', 'pvccsram': 'PVCCSRAM', 'p1v05_a': 'P1V05_A', '5vsb': '5VSB', '33vsb': '3.3VSB', 'pvnn': 'PVNN', 'pvpp': 'PVPP', 'p1v538_a': 'P1V538_A', '12v_bmc': '1.2V BMC', 'pvcc_ref': 'PVCC_REF'}, 'fan': {'fan1': 'FAN1', 'fan2': 'FAN2', 'fan3': 'FAN3', 'fana': 'FANA'}, 'power': {}, 'time': {}}, states={'cpu_temp': 44.0, 'system_temp': 39.0, 'peripheral_temp': 35.0, 'dimma1_temp': 42.0, 'dimma2_temp': 40.0, 'dimmb1_temp': 42.0, 'dimmb2_temp': 42.0, 'fan1': 1100.0, 'fan2': 600.0, 'fan3': None, 'fana': None, '12v': 12.256, '5vcc': 5.0, '33vcc': 3.367, 'vbat': 3.146, 'vcpu': 1.026, 'vdimm': 1.218, 'pvccsram': 1.024, 'p1v05_a': 1.059, '5vsb': 4.948, '33vsb': 3.317, 'pvnn': 0.8200000000000001, 'pvpp': 2.696, 'p1v538_a': 1.545, '12v_bmc': 1.209, 'pvcc_ref': 1.286}, alias='supermicro')
[custom_components.ipmi.sensor] Sensors added
[custom_components.ipmi] 'ipmi-server' addon is not available. Let's use RMCP.
[custom_components.ipmi] 0x025f |  67 | FAN3               | ERR: CC=0xcb
[custom_components.ipmi] 0x02a2 |  68 | FANA               | ERR: CC=0xcb
[custom_components.ipmi] Finished fetching IPMI resource status data in 0.468 seconds (success: True)
ateodorescu commented 10 months ago

If you can read the sensors then it's strange that you don't see the values in home assistant. Please try to open the following url in your browser: http://YOUR_HASS_IP:9595/?host=YOUR_SERVER_IP&port=623&user=YOUR_USER&password=YOUR_PASSWORD and let's see what it returns. YOUR_HASS_IP is the IP address of your home assistant server. YOUR_SERVER_IP is the IP address of the IPMI server.

The response should be a json with all sensor values in it.

janek202 commented 10 months ago

I ran it, and I got a json back:

{
    "success": true,
    "device": {
        "device_id": "xxx",
        "device_revision": "xxx",
        "firmware_revision": "xxx",
        "ipmi_version": "2.0",
        "manufacturer_id": "xxx",
        "manufacturer_name": "Super Micro Computer Inc.",
        "product_id": "xxx",
        "product_name": "A2SDi-HLN4F",
        "device_available": "yes",
        "provides_device_sdrs": "no",
        "fru_device_description": "Builtin FRU Device (ID 0)",
        "board_mfg_date": "xxx",
        "board_mfg": "Supermicro"
    },
    "power_on": true,
    "sensors": {
        "power": [],
        "time": [],
        "temperature": {
            "cpu_temp": "CPU Temp",
            "system_temp": "System Temp",
            "peripheral_temp": "Peripheral Temp",
            "dimma1_temp": "DIMMA1 Temp",
            "dimma2_temp": "DIMMA2 Temp",
            "dimmb1_temp": "DIMMB1 Temp",
            "dimmb2_temp": "DIMMB2 Temp"
        },
        "voltage": {
            "12v": "12V",
            "5vcc": "5VCC",
            "33vcc": "3.3VCC",
            "vbat": "VBAT",
            "vcpu": "Vcpu",
            "vdimm": "VDIMM",
            "pvccsram": "PVCCSRAM",
            "p1v05_a": "P1V05_A",
            "5vsb": "5VSB",
            "33vsb": "3.3VSB",
            "pvnn": "PVNN",
            "pvpp": "PVPP",
            "p1v538_a": "P1V538_A",
            "12v_bmc": "1.2V BMC",
            "pvcc_ref": "PVCC_REF"
        },
        "fan": {
            "fan1": "FAN1",
            "fan2": "FAN2",
            "fan3": "FAN3",
            "fana": "FANA"
        }
    },
    "states": {
        "cpu_temp": "52",
        "system_temp": "45",
        "peripheral_temp": "40",
        "dimma1_temp": "50",
        "dimma2_temp": "46",
        "dimmb1_temp": "51",
        "dimmb2_temp": "51",
        "12v": "12.26",
        "5vcc": "5",
        "33vcc": "3.37",
        "vbat": "3.12",
        "vcpu": "0.72",
        "vdimm": "1.22",
        "pvccsram": "1.02",
        "p1v05_a": "1.06",
        "5vsb": "4.95",
        "33vsb": "3.32",
        "pvnn": "0.82",
        "pvpp": "2.70",
        "p1v538_a": "1.54",
        "12v_bmc": "1.22",
        "pvcc_ref": "1.29",
        "fan1": "1500",
        "fan2": "700",
        "fan3": null,
        "fana": null
    },
    "debug": "Error occurred when running \u0022ipmitool -H <IPMI_IP> -p 623 -U <USER> -P <PASSWORD> -I lanplus dcmi power reading\u0022.\n\n    DCMI request failed because: Invalid command (c1)\n\nError occurred when running \u0022ipmitool -H <IPMI_IP> -p 623 -U <USER> -P <PASSWORD> -I lan dcmi power reading\u0022.\n\n    DCMI request failed because: Invalid command (c1)\n\nError occurred when running \u0022ipmitool -H <IPMI_IP> -p 623 -U <USER> -P <PASSWORD> -I imb dcmi power reading\u0022.\nError loading interface imb\n\nError occurred when running \u0022ipmitool -H <IPMI_IP> -p 623 -U <USER> -P <PASSWORD> -I open dcmi power reading\u0022.\nCould not open device at \/dev\/ipmi0 or \/dev\/ipmi\/0 or \/dev\/ipmidev\/0: No such file or directory\n"
}
ateodorescu commented 10 months ago

That means that you should at least see the temperature, voltage and fan sensors in home assistant. Don't you see them in HASS? Don't they have values in HASS?

janek202 commented 10 months ago

I see these sensors, but they don't have any values. Home assistant shows them as not available:

image
ateodorescu commented 10 months ago

Now that is strange! Try to restart HASS. Maybe that fixes it. I don't know what is causing that issue.

ateodorescu commented 10 months ago

If you use the OS then restart everything so that addons get restarted too.

janek202 commented 10 months ago

I think I may have found something. When I completely removed this device, and set it up from scratch, while the server was running, all sensors show values correctly. With and without the addon.

When I power the server off, they become not available, as expected. But when I power it back on, sensors are not enabled back. Even restarting Home Assistant doesn't fix it.

I briefly looked at the code, and maybe this is an issue?

     if not value:
            enabled = False

When the server is powered off, sensors don't have any values on my motherboard, so I guess this code disables them? Maybe there should be some logic that takes server state into account, and skips sensor refresh when the system is off?

I usually keep this system off, because of power consumption and noise, and wanted to migrate to this integration from Wake on Lan :).

ateodorescu commented 10 months ago

Thanks for looking into this. I'll try to test this scenario so I can enable or disable sensors properly when the server is on or off.

ateodorescu commented 10 months ago

@janek202, please try the latest version 1.2.0. The sensors should now become available/unavailable based on what the server returns. Hope this helps.

janek202 commented 10 months ago

@ateodorescu, thank you! I tried it and all sensors showed up, when I powered on my server. So far everything's looking good.