HP iLO4 command line interface (CLI) guide and cheatsheet with examples

In my last article I had shared the steps to set up SNTP server on the iLO so that your blade is always in sync with your NTP server and it always reflects correct date and time as during troubleshooting with incorrect date and time it becomes impossible to analyse the problem.

Here you can find HPE Virtual Connect based commands and cheat sheet with examples to configure a shared uplink set.

With below article I will share some of the important commands which can be used to configure and manage HPE based integrated Lights Out Manager (iLO4)

Assuming your iLO is only configured via OA and it doesnot has any other active user account then you will not be able to do a direct ssh to your iLO

Login to your Onboard Administrator using any CLI based ssh client
Once connected execute below command

BlrSiteA1-01-01> CONNECT SERVER 01

Connecting to bay 1 ...
User:OAtmp-HPadmin-5A1FB897 logged-in to 17-inst01-a.BlrSiteA(192.168.1.10 / FE80::7210:6FFF:FEC0:153A)

iLO 4 Advanced for BladeSystem 2.55 at  Aug 16 2017
Server Name: enclosure1
Server Power: On

</>hpiLO->

Now since you have successfully connected to your iLO let us start configuring and managing our iLO

Create User

In the below command we are creating HPadmin user with password as Passw0rd

</>hpiLO-> create /map1/accounts1 username=HPadmin password=Passw0rd

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 10:47:57 2018

User added successfully.

Show the list of users

</>hpiLO-> show /map1/accounts1

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 11:01:17 2018

/map1/accounts1
  Targets
    Administrator
    HPadmin
    emergency
  Properties
  Verbs
    cd version exit show create delete set

Changing password of a user

</>hpiLO-> set /map1/accounts1/emergency password=Passw0rd

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 11:06:25 2018

Firmware Commands

To view the firmware of the iLO

To check the firmware of your iLO4 use the below command
</>hpiLO-> show /map1/firmware1

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 11:07:42 2018

/map1/firmware1
  Targets
  Properties
    version=2.55
    date=Aug 16 2017
    name=iLO 4
  Verbs
    cd version exit show load

Network Configuration

IMPORTANT NOTE: After modifying network related configuration the iLO will RESET to activate the new changes

To view the assigned network of the blade

</>hpiLO-> show /map1/enetport1/lanendpt1/ipendpt1

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:06:42 2018

/map1/enetport1/lanendpt1/ipendpt1
  Targets
  Properties
    IPv4Address=10.10.10.100
    SubnetMask=255.255.255.0
    AddressOrigin=Static
  Verbs
    cd version exit show set

To assign management IP to the blade iLO page

</>hpiLO-> set /map1/enetport1/lanendpt1/ipendpt1 IPv4Address=10.10.10.100 SubnetMask=255.255.255.0

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:10:49 2018

Network settings change applied.

Settings change applied, iLO 4 will now be reset.
Logged Out: It may take several minutes before you can log back in.

CLI session stopped

Change or modify the gateway of the management IP

</>hpiLO-> set  /map1/gateway1 AccessInfo=10.10.10.254

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:14:39 2018

Network settings change applied.

Settings change applied, iLO 4 will now be reset.
Logged Out: It may take several minutes before you can log back in.

CLI session stopped

Similarly you can also configure DNS server if you have any
NOTE: You can set upto 3 dnsserver for the blade

To add a dns server use the below command

</>hpiLO-> set /map1/dnsserver1 AccessInfo=1.2.3.4

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:18:03 2018

Network settings change applied.

Settings change applied, iLO 4 will now be reset.
Logged Out: It may take several minutes before you can log back in.

CLI session stopped

Enable or disable DHCP

To view the existing dhcpd status of the iLO

</>hpiLO-> show /map1/dhcpendpt1

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:19:04 2018

/map1/dhcpendpt1
  Targets
  Properties
    EnabledState=no
    OtherTypeDescription=DHCP
  Verbs
    cd version exit show set

To enable ro disable this use below command

</>hpiLO-> set /map1/dhcpendpt1 EnabledState=no

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:19:48 2018

Network settings change applied.

Settings change applied, iLO 4 will now be reset.
Logged Out: It may take several minutes before you can log back in.

CLI session stopped

Configure SNMP

To view the existing SNMP configuration

</>hpiLO-> show /map1/snmp1

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:22:21 2018

/map1/snmp1
  Targets
  Properties
    accessinfo1=0
    readcom1=""
    trapcom1=""
    accessinfo2=0
    readcom2=""
    trapcom2=""
    accessinfo3=0
    readcom3=""
    trapcom3=""
    oemhp_iloalert=yes
    oemhp_agentalert=yes
    oemhp_snmppassthru=no
    oemhp_agentlessenable=yes
    oemhp_systemlocation=""
    oemhp_systemcontact=""
    oemhp_systemrole=""
    oemhp_systemroledetail1=""
    oemhp_systemroledetail2=""
    oemhp_systemroledetail3=""
    oemhp_systemroledetail4=""
    oemhp_systemroledetail5=""
    oemhp_imagenturl=server1
    oemhp_imdatalevel=enabled
    oemhp_coldstarttrap=yes
    oemhp_trapsource=iLO Hostname
  Verbs
    cd version exit show set

To configure new SNMP value

</>hpiLO-> set /map1/snmp1 accessinfo1=1.2.3.4

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:26:30 2018

SNMP settings modified.

Set the system location

</>hpiLO-> set /map1/snmp1/ oemhp_systemlocation="Bangalore"

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:28:11 2018

SNMP settings modified.

Set system point of contact

</>hpiLO-> set /map1/snmp1/ oemhp_systemcontact="Deepak Prasad"

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:28:44 2018

SNMP settings modified.

Set the role of the engineer

</>hpiLO-> set /map1/snmp1/ oemhp_systemrole="Engineer"

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:29:01 2018

SNMP settings modified.

Finally view the modified changes

</>hpiLO-> show /map1/snmp1/

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:29:06 2018

/map1/snmp1
  Targets
  Properties
    accessinfo1=1.2.3.4
    readcom1=""
    trapcom1=""
    accessinfo2=0
    readcom2=""
    trapcom2=""
    accessinfo3=0
    readcom3=""
    trapcom3=""
    oemhp_iloalert=yes
    oemhp_agentalert=yes
    oemhp_snmppassthru=no
    oemhp_agentlessenable=yes
    oemhp_systemlocation="Bangalore"
    oemhp_systemcontact="Deepak Prasad"
    oemhp_systemrole="Engineer"
    oemhp_systemroledetail1=""
    oemhp_systemroledetail2=""
    oemhp_systemroledetail3=""
    oemhp_systemroledetail4=""
    oemhp_systemroledetail5=""
    oemhp_imagenturl=server1
    oemhp_imdatalevel=enabled
    oemhp_coldstarttrap=yes
    oemhp_trapsource=iLO Hostname
  Verbs
    cd version exit show set

Assign Name to the blade

IMPORTANT NOTE: The iLO will reset after executing this command hence the connection the iLO will be lost, reconnect to the iLO4 in a couple of minutes

</>hpiLO-> set /map1/enetport1 SystemName=server1

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 11:08:33 2018

Network settings change applied.

Settings change applied, iLO 4 will now be reset.
Logged Out: It may take several minutes before you can log back in.

CLI session stopped

Connection terminated by server.

Re-connect to the iLO once it is UP again after activating the changes

BlrSiteA1-01-01> CONNECT SERVER 02

Connecting to bay 2 ...
User:OAtmp-HPadmin-5A2FB954 logged-in to server1.BlrSiteA(10.10.10.100 / FE80::7210:6FFF:FEC0:1526)

iLO 4 Advanced for BladeSystem 2.55 at  Aug 16 2017
Server Name: server1
Server Power: On

</>hpiLO->

Validate your changes

</>hpiLO-> show /map1/enetport1/ SystemName

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:13:38 2018

/map1/enetport1
  Properties
    SystemName=server1
  Verbs
    cd version exit show set

Set and show power related values

Below table can be used to understand the meaning of different power values

Syntax

show /system1/oemhp_power1 <variable>
set /system1/oemhp_power1 <variable=value>

For example to view the power reading value from last 24h

</>hpiLO-> show /system1/oemhp_power1 oemhp_AvgPower

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 11:18:50 2018

/system1/oemhp_power1
  Properties
    oemhp_AvgPower=82 Watts
  Verbs
    cd version exit show set

To modify the power on delay value

</>hpiLO-> set /system1/oemhp_power1 oemhp_auto_pwr=15

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 11:53:16 2018

View and change boot order

To view all the available boot option

</>hpiLO-> show /system1/bootconfig1

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 12:05:52 2018

/system1/bootconfig1
  Targets
    bootsource1
    bootsource2
    bootsource3
    bootsource4
    bootsource5
  Properties
    oemhp_bootmode=Legacy
    oemhp_secureboot=Not Available
    oemhp_pendingbootmode=Legacy
  Verbs
    cd version exit show set

You can view the individual bootsource to understand the media mapped to the respective bootsource

The boot source targets and matching boot source values do not change. The values for bootsource are:
bootsource1: BootFmCd
bootsource2: BootFmFloppy
bootsource3: BootFmDrive
bootsource4: BootFmUSBKey
bootsource5: BootFmNetwork

To view the boot order of "individual boot source"

</>hpiLO-> show /system1/bootconfig1/bootsource1

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 12:24:03 2018

/system1/bootconfig1/bootsource1
  Targets
  Properties
    bootorder=2
    bootdevice=BootFmCd
  Verbs
    cd version exit show set

To view the boot order of all the available boot source

</>hpiLO->  show -all /system1/bootconfig1

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 12:19:59 2018

/system1/bootconfig1
  Targets
    bootsource1
    bootsource2
    bootsource3
    bootsource4
    bootsource5
  Properties
    oemhp_bootmode=Legacy
    oemhp_secureboot=Not Available
    oemhp_pendingbootmode=Legacy
  Verbs
    cd version exit show set

/system1/bootconfig1/bootsource1
  Targets
  Properties
    bootorder=1
    bootdevice=BootFmCd
  Verbs
    cd version exit show set

/system1/bootconfig1/bootsource2
  Targets
  Properties
    bootorder=2
    bootdevice=BootFmDisk
  Verbs
    cd version exit show set

/system1/bootconfig1/bootsource3
  Targets
  Properties
    bootorder=3
    bootdevice=BootFmUSBKey
  Verbs
    cd version exit show set

/system1/bootconfig1/bootsource4
  Targets
  Properties
    bootorder=4
    bootdevice=BootFmNetwork1
  Verbs
    cd version exit show set

/system1/bootconfig1/bootsource5
  Targets
  Properties
    bootorder=5
    bootdevice=BootFmNetwork2
  Verbs
    cd version exit show set

To change the boot order
Here I am changing my first boot device to HDD

</>hpiLO-> set /system1/bootconfig1/bootsource2 bootorder=1

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 12:22:25 2018

Bootorder being set.

bootsource2=BootFmDisk      bootorder=1
bootsource1=BootFmCd        bootorder=2
bootsource3=BootFmUSBKey    bootorder=3
bootsource4=BootFmNetwork1   bootorder=4
bootsource5=BootFmNetwork2   bootorder=5

LED commands

To show the LED status

</>hpiLO-> show /system1/led1

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 12:25:56 2018

/system1/led1
  Targets
  Properties
    enabledstate=disabled
  Verbs
    cd version exit show start stop

To start the LED

</>hpiLO-> start /system1/led1

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 12:26:51 2018

Virtual Media Commands

To mount a cd or dvd image you must have the location of the iso image
As you see currently there is no image mounted on my iLO

</>hpiLO-> show /map1/oemhp_vm1/cddr1

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 12:31:25 2018

/map1/oemhp_vm1/cddr1
  Targets
  Properties
    oemhp_image=None
    oemhp_connect=No
    oemhp_boot=No_Boot
    oemhp_wp=No
    vm_applet=No
  Verbs
    cd version exit show set

To mount an iso available on http server
The oemhp image value is a URL. The URL, which is limited to 80 characters, specifies the location of the virtual media image file on an HTTP server and is in the same format as the scriptable virtual media image location.

URL example: protocol://username:password@hostname:port/filename

protocol —Mandatory field that must be HTTP or HTTPS
username:password —Optional field
hostname —Mandatory field
port —Optional field
filename —Mandatory field

</>hpiLO-> cd /map1/oemhp_vm1/cddr1

</map1/oemhp_vm1/cddr1>hpiLO-> set oemhp_image=http://10.43.22.100/bp-server-sum-2017-10-v2.iso

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 12:36:14 2018

</>hpiLO-> set /map1/oemhp_vm1/cddr1 oemhp_boot=connect

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 12:39:07 2018

To view the changes

</map1/oemhp_vm1/cddr1>hpiLO-> show

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 12:39:28 2018

/map1/oemhp_vm1/cddr1
  Targets
  Properties
    oemhp_image=http://10.43.22.100/bp-server-sum-2017-10-v2.iso
    oemhp_connect=Yes
    oemhp_boot=Always
    oemhp_wp=Yes
    vm_applet=No
  Verbs
    cd version exit show set

To disconnect the dvd/cd image

</>hpiLO-> set /map1/oemhp_vm1/cddr1 oemhp_boot=disconnect

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 12:39:58 2018

To set one time boot menu for the inserted DVD

</>hpiLO-> set /map1/oemhp_vm1/cddr1 oemhp_boot=once

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 12:54:33 2018

Blade commands

To view the blade details and blade slot in the rack
Here we know now that the connected blade is on bay 2 and the enclosure IP Address is 192.168.1.10

</>hpiLO-> show /map1/blade1

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:33:51 2018

/map1/blade1
  Targets
    rack
  Properties
    bay_number=2
    auto_power=on
    ip_address=192.168.1.10
    mac_address=94:18:82:72:25:4b
    sys_health=OK
  Verbs
    cd version exit show set

CPU Commands

To view the CPU information of the blade

</>hpiLO-> show /system1/cpu1

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:36:21 2018

/system1/cpu1
  Targets
  Properties
    name=Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz
    status=OK
    number_cores=8
    active_cores=8
    threads=16
    speed=2600MHz
    memory_technology=64-bit Capable
    cachememory1=512KB
    cachememory2=2048KB
    cachememory3=20480KB
  Verbs
    cd version exit show

</>hpiLO-> show /system1/cpu2

status=0
status_tag=COMMAND COMPLETED
Fri Feb 23 13:36:24 2018

/system1/cpu2
  Targets
  Properties
    name=Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz
    status=OK
    number_cores=8
    active_cores=8
    threads=16
    speed=2600MHz
    memory_technology=64-bit Capable
    cachememory1=512KB
    cachememory2=2048KB
    cachememory3=20480KB
  Verbs
    cd version exit show

References:
iLO4 Scripting and Command Line Guide

I hope the article was useful