Stackvora.tech

HPE iLO: automate server tasks with the Redfish API

HPE Integrated Lights-Out (iLO) is a proprietary server management technology embedded in HPE ProLiant servers and Synergy compute modules. While iLO has…

HPE Integrated Lights-Out (iLO) is a proprietary server management technology embedded in HPE ProLiant servers and Synergy compute modules. While iLO has traditionally offered a web interface, SSH, and a proprietary scripting language (RIBCL), modern automation workflows increasingly rely on standard, API-driven approaches. The Redfish API, a DMTF (Distributed Management Task Force) standard, provides a vendor-neutral, RESTful interface for managing server hardware, making it a powerful tool for integrating HPE iLO into existing IT automation platforms.

This article details how to interact with HPE iLO's Redfish API, covering essential operations from discovering server properties to controlling power states and managing firmware updates. It focuses on using standard HTTP methods and JSON payloads, suitable for scripting with tools like curl or integrating with programming languages.

Enabling and Accessing Redfish on HPE iLO

Redfish is generally enabled by default on iLO 4 (firmware 2.50+) and all iLO 5 and iLO 6 versions. Access is typically over HTTPS on port 443. Authentication uses the same credentials as the iLO web interface (username and password). It's crucial to use a dedicated iLO user with appropriate permissions for API access, rather than the default administrator account, and to use strong, unique passwords.

The base Redfish service entry point for HPE iLO is usually /redfish/v1/. You can verify Redfish availability and retrieve the service root document using a simple GET request:

curl -sku <iLO_username>:<iLO_password> https://<iLO_IP_or_hostname>/redfish/v1/ | jq .

The -s flag silences curl's progress meter, -k allows insecure SSL connections (useful for self-signed certificates, but avoid in production unless certificate validation is handled otherwise), and -u specifies basic authentication credentials. jq is a powerful JSON processor that helps in pretty-printing and parsing the output.

Discovering Server Resources

Redfish structures server management data as a hierarchy of resources. The service root (/redfish/v1/) provides links to top-level collections. For server hardware, the primary entry point is typically the /redfish/v1/Systems collection.

Listing Systems

To list all managed computer systems (usually just one in a typical ProLiant server), query the Systems collection:

curl -sku <iLO_username>:<iLO_password> https://<iLO_IP_or_hostname>/redfish/v1/Systems | jq .

The response will contain an "Members" array, each element pointing to a specific system instance, e.g., "/redfish/v1/Systems/1". The "1" here is the system ID, which is common for single-node servers.

Retrieving System Details

To get detailed information about a specific system, make a GET request to its URI:

curl -sku <iLO_username>:<iLO_password> https://<iLO_IP_or_hostname>/redfish/v1/Systems/1 | jq .

This will return a large JSON object containing information like model, serial number, processor details, memory, boot options, and power state. Key properties include:

  • Model: Server model (e.g., "ProLiant DL380 Gen10 Plus")
  • SerialNumber: Server's physical serial number
  • PowerState: Current power status ("On", "Off")
  • Boot: Boot settings, including BootSourceOverrideTarget
  • Processors, Memory, NetworkInterfaces, Storage: Links to sub-collections for detailed component information.

Controlling Server Power and Boot Options

One of the most common automation tasks is managing server power and boot settings. These actions are performed using POST requests to specific action URIs.

Checking Power State

To quickly check the current power state of System 1:

curl -sku <iLO_username>:<iLO_password> https://<iLO_IP_or_hostname>/redfish/v1/Systems/1 | jq .PowerState

This command extracts just the PowerState property from the system details.

Performing Power Actions

Power operations are handled via the ComputerSystem.Reset action. The available ResetType values include:

  • On: Power on the system.
  • ForceOff: Immediately power off, equivalent to pulling the plug.
  • GracefulShutdown: Initiate an ACPI-compliant graceful shutdown. Requires OS cooperation.
  • GracefulRestart: Initiate a graceful shutdown followed by a power-on. Requires OS cooperation.
  • ForceRestart: Immediately power off and then power on.
  • PushPowerButton: Simulates a momentary press of the power button.

Example: Gracefully restarting the server:

curl -sku <iLO_username>:<iLO_password> -X POST -H 'Content-Type: application/json' -d '{"ResetType":"GracefulRestart"}' https://<iLO_IP_or_hostname>/redfish/v1/Systems/1/Actions/ComputerSystem.Reset

Example: Powering off the server immediately:

curl -sku <iLO_username>:<iLO_password> -X POST -H 'Content-Type: application/json' -d '{"ResetType":"ForceOff"}' https://<iLO_IP_or_hostname>/redfish/v1/Systems/1/Actions/ComputerSystem.Reset

Always verify the action completed successfully by checking the HTTP status code (200 OK or 202 Accepted) and subsequently querying the PowerState.

Setting One-Time Boot Options

To boot from a specific device just for the next power cycle, you can modify the BootSourceOverrideTarget and set BootSourceOverrideMode (e.g., UEFI or Legacy) and BootSourceOverrideEnabled to Once.

Common BootSourceOverrideTarget values:

  • Pxe: Network boot (PXE)
  • Cd: CD/DVD-ROM (virtual or physical)
  • Usb: USB drive
  • Hdd: Hard drive (default)
  • BiosSetup: Enter BIOS/UEFI setup utility
  • Diags: Run diagnostics (if supported)

Example: Set a server to PXE boot once:

curl -sku <iLO_username>:<iLO_password> -X PATCH -H 'Content-Type: application/json' \
    -d '{"Boot": {"BootSourceOverrideTarget": "Pxe", "BootSourceOverrideMode": "UEFI", "BootSourceOverrideEnabled": "Once"}}' \
    https://<iLO_IP_or_hostname>/redfish/v1/Systems/1

After setting the boot option, you would typically issue a GracefulRestart or ForceRestart command for the change to take effect.

Firmware and BIOS Management (HPE-specific Redfish Extensions)

While Redfish defines standard ways to manage firmware (via the UpdateService), vendors often implement extensions for specific functionalities like HPE's Smart Update Manager (SUM) integration or custom BIOS settings. HPE iLO uses the /redfish/v1/UpdateService for firmware and BIOS updates and the /redfish/v1/Managers/1/UpdateService for iLO firmware updates.

Listing Available Firmware

To see currently installed firmware and BIOS versions, you can explore the FirmwareInventory collection:

curl -sku <iLO_username>:<iLO_password> https://<iLO_IP_or_hostname>/redfish/v1/UpdateService/FirmwareInventory | jq .

This will list entries for BIOS, iLO, various controllers (RAID, network), etc., including their Version and Description.

Initiating Firmware Updates

Firmware updates are typically handled by uploading the firmware image to the iLO's UpdateService and then initiating the update task. HPE iLO supports several methods for firmware updates, including HTTP/HTTPS, SCP, SFTP, and local file upload.

Example: Initiating a firmware update from a URL (e.g., an internal HTTP server hosting the firmware image):

curl -sku <iLO_username>:<iLO_password> -X POST -H 'Content-Type: application/json' \
    -d '{"ImageURI": "http://<firmware_server_IP>/firmware/ilo5_2.80.bin", "TransferProtocol": "HTTP"}' \
    https://<iLO_IP_or_hostname>/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate

This initiates an asynchronous task. You'll get a 202 Accepted response and a Location header pointing to the task monitor URI (e.g., /redfish/v1/TaskService/Tasks/1). You can poll this URI to check the update status.

For BIOS settings, HPE iLO 5 (version 1.40 and later) and iLO 6 expose BIOS configuration through the /redfish/v1/Systems/1/Bios URI. You can GET this resource to see current settings and PATCH it to modify values. For example, to set a specific boot mode:

curl -sku <iLO_username>:<iLO_password> -X PATCH -H 'Content-Type: application/json' \
    -d '{"Attributes": {"BootMode": "Uefi"}}' \
    https://<iLO_IP_or_hostname>/redfish/v1/Systems/1/Bios

Note that many BIOS changes require a server reboot to take effect.

Vendor-Neutrality and Cross-Platform Automation

The core promise of Redfish is vendor-neutrality. While HPE iLO includes some specific extensions (prefixed with Hp or Hpe in the Redfish schema), the fundamental paths for power control, boot options, and system inventory are standardized. This means that scripts developed for HPE iLO can often be adapted with minimal changes for other Redfish-compliant BMCs like:

  • Dell iDRAC (version 9+ recommended): Base URI is typically /redfish/v1/. System URI is often /redfish/v1/Systems/System.Embedded.1. Power operations and boot settings are very similar.
  • Lenovo XCC (e.g., ThinkSystem servers): Base URI is /redfish/v1/. System URI is often /redfish/v1/Systems/1. Similar structure for power and boot.
  • Supermicro BMCs: Recent firmware versions support Redfish.

The key differences typically lie in:

  • The exact URI for the main system resource (e.g., /Systems/1 vs. /Systems/System.Embedded.1).
  • Vendor-specific extensions for highly specialized features (e.g., GPU control, advanced RAID configurations).
  • The naming conventions of some attributes within the standard Redfish resources.

For robust, cross-platform automation, it's best to discover these URIs programmatically by traversing the Redfish service root and looking for @odata.id links, rather than hardcoding them.

Common Pitfalls

  • Self-signed Certificates: By default, iLO uses a self-signed SSL certificate. curl -k bypasses validation, but for production scripts, consider importing the iLO certificate into your trust store or deploying proper, signed certificates to iLO.
  • iLO Firmware Version: Ensure your iLO firmware is up-to-date. Older versions (especially iLO 4 below 2.50) may have limited or no Redfish support, or implement an older, less complete Redfish schema. HPE iLO 5 and 6 offer the most comprehensive Redfish support.
  • Permissions: The iLO user account used for Redfish access must have sufficient privileges for the operations being performed (e.g., "Power Management" for power cycling, "Update Firmware" for updates).
  • Asynchronous Tasks: Many Redfish operations (especially power cycles and firmware updates) are asynchronous. The API call returns immediately with a 202 Accepted status and a link to a "Task" resource. You must then poll this Task resource to determine the actual completion status and any results.
  • JSON Structure: Redfish relies heavily on JSON. Pay close attention to nested objects and array structures when constructing PATCH or POST payloads. Tools like jq are invaluable for inspecting responses.
  • HTTP Methods: Use the correct HTTP method: GET for retrieving data, POST for initiating actions or creating resources, PATCH for modifying existing resource properties.

Back to the knowledge base · Ask the AI assistant