HPE iLO 5 Redfish API: Power, Reset and BIOS via curl - 夜莺博客

HPE iLO 5 Redfish API: Power, Reset and BIOS via curl

The Redfish API turns HPE iLO 5 into a scriptable management endpoint: every action you can click in the web interface has a REST equivalent, which means power control, BIOS inventory and log collection can all live in a playbook. This guide walks the resource tree, the correct way to invoke Redfish Actions, and the curl and iLOrest commands for the four tasks administrators do most often. Examples are standard Redfish unless an HPE OEM action is the only way to reach a feature.

Authentication and the resource tree

iLO 5 accepts HTTP Basic authentication, so the fastest way to explore is a plain curl with --insecure against a self-signed certificate.

curl --insecure -u ilo-user:password --location \
     https://{iLO}/redfish/v1/

curl --insecure -u ilo-user:password --location \
     https://{iLO}/redfish/v1/Systems/1/

Three branches do most of the work: /Systems/1 (the computer system — power state, BIOS, storage, network adapters), /Chassis/1 (thermal, power, physical inventory) and /Managers/1 (iLO itself). Use ?$select= to trim responses, for example GET /redfish/v1/Systems/1/?$select=Actions.

Reading and changing BIOS settings

curl --insecure -u username:password --location \
     https://{iLO}/redfish/v1/systems/1/bios/

The same data is much easier to consume through iLOrest, which handles the pending-versus-current attribute split for you.

ilorest login ilo-ip -u ilo-user -p password
ilorest select Bios.
ilorest set "AdminName=John D'euf" AdminEmail="admin@example.com"
ilorest commit
ilorest reboot ColdBoot
ilorest logout

Note the two-step model: set stages attributes in the pending settings resource, commit applies them, and a reboot finishes the job. Attributes left staged but never committed are a common source of "my BIOS change did not take effect".

Power control with ComputerSystem.Reset

Power operations are Redfish Actions, which means an HTTP POST to a target URI with a parameter that has a fixed list of legal values. Read the list before you send anything.

curl --insecure -u ilo-user:password --location \
     https://{iLO}/redfish/v1/Systems/1/?\$select=Actions

curl --insecure -H "Content-Type: application/json" --request POST \
     --data '{"ResetType": "ForceRestart"}' \
     https://{iLO}/redfish/v1/Systems/1/Actions/ComputerSystem.Reset \
     -u username:password --insecure

Typical ResetType values are On, ForceOff, ForceRestart, Nmi and PushPowerButton. Always query ResetType@Redfish.AllowableValues first rather than assuming: the supported set varies by platform and firmware, and an unsupported value returns a 400 with no state change.

Resetting the management controller

Resetting iLO itself is safe for the running operating system. HPE implements GracefulRestart as a forced restart, so treat both values as a hard iLO reboot.

GET  /redfish/v1/Managers/1/?\$select=Actions

POST /redfish/v1/Managers/1/Actions/Manager.Reset/
Body: {"ResetType": "ForceRestart"}

When Redfish behaviour looks stale — cached inventory, an action that reports success but changes nothing — clear the REST state and reset:

POST /redfish/v1/Managers/1/Actions/Oem/Hpe/HpeiLO.ClearRestApiState/
Body: {} or none

HPE OEM actions worth knowing

Some hardware functions have no standard Redfish equivalent and live under an Oem/Hpe target. The power-button action simulates a physical press:

curl --insecure -u ilo-user:password --header "Content-Type: application/json" \
  --request POST --data '{"PushType": "PressAndHold"}' \
  https://ilo-ip/redfish/v1/Systems/1/Actions/Oem/Hpe/HpeComputerSystemExt.PowerButton/

Another simulates pulling the power cables — the e-fuse or auxiliary power cycle — which is the only clean way to reset certain cards without a trip to the datacentre.

POST: /redfish/v1/Systems/1/Actions/Oem/Hpe/HpeComputerSystemExt.SystemReset/

Automation checklist

  • Create a dedicated iLO account with the minimum privileges — most actions need Configure, reads need Login.
  • Never embed --insecure in production scripts; import the iLO CA certificate instead.
  • Poll the task monitor for long-running actions rather than assuming a 200 means finished.
  • Log the Redfish response body on failure; HPE returns a useful MessageId extended info block.

Pair this with the certificate and networking steps in our HPE iLO 5 initial setup guide, and if you manage mixed fleets the differences between vendors are summarised in iDRAC Redfish API automation guide.

原文链接:https://servermanagementportal.ext.hpe.com/docs/examples/redfishexamples