Update IPMI Attribute Using API

Hello, first time here…
I am having trouble updating the ipmi_hostname attribute on a given host using the API.
Most of the output below can be ignored, just giving you an idea of my issue.

So this is the current information about a server that has been added to librenms, using the API.

curl -k -H 'X-Auth-Token: APITOKENHERE' 'https://librenms.help/api/v0/devices/24'
{
    "status": "ok",
    "devices": [
        {
            "device_id": "24",
            --- OUTPUT OMITTED ---
            "notes": "",
            "attribs": {
                "ipmi_hostname": "10.10.10.10",
                "ipmi_type": "imb"
            },
            "os_group": "unix"
        }
    ],
    "count": 1
}

What I want is to change the “ipmi_hostname” within “attribs”:

curl -k X PATCH -d '{"field": "ipmi_hostname", "data": "172.16.16.16"}' -H 'X-Auth-Token: APITOKENHERE'  https://librenms.help/api/v0/devices/24
{
    "status": "ok",
    "message": "Device ipmi_hostname field has been updated"
}

But nothing happened to “ipmi_hostname”?

curl -k -H 'X-Auth-Token: APITOKENHERE' 'https://librenms.help/api/v0/devices/24'
{
    "status": "ok",
    "devices": [
        {
            "device_id": "24",
            --- OUTPUT OMITTED ---
            "notes": "",
            "attribs": {
                "ipmi_hostname": "10.10.10.10",
                "ipmi_type": "imb"
            },
            "os_group": "unix"
        }
    ],
    "count": 1
}

And I do the same for “notes”:

curl -k -X PATCH -d '{"field": "notes", "data": "IPMI IS: 172.16.16.16"}' -H 'X-Auth-Token: APITOKENHERE'  https://librenms.help/api/v0/devices/24
{
    "status": "ok",
    "message": "Device notes field has been updated"
}

It updates the “notes” field as expected.

curl -k -H 'X-Auth-Token: APITOKENHERE' 'https://librenms.help/api/v0/devices/24'
{
    "status": "ok",
    "devices": [
        {
            "device_id": "24",
            --- OUTPUT OMITTED ---
            "notes": "IPMI IS: 172.16.16.16",
            "attribs": {
                "ipmi_hostname": "10.10.10.10",
                "ipmi_type": "imb"
            },
            "os_group": "unix"
        }
    ],
    "count": 1
}

Commands used were found in the documentation.

Any solutions, ideas or pointers would be appreciated. Thank you.

Did you ever solve this?

The basic problem is, that ipmi_hostname is part of “attribs”

I’ve tried to update attribs like this, but not luck either:

curl -X PATCH -d ‘{“field”: “attribs”, “data”: “{ override_Oxidized_disable: false }”}’ -H ‘X-Auth-Token: token’ https://libre/api/v0/devices/37

I have yet to find a solution myself, currently still updating the ipmi data using the librenms webinterface.

1 Like

Aloha,
Did you ever found out, how to update the attrib variables via API?
I have the same problem and dont know, how to solve this.