EZH - Easy HMC Command Line Interface

EZH is a script for the IBM HMC console to provide an alternate, easier to use, command line interface for many common commands and the goal of the project is to make the HMC command line interface easier to use for day to day administration tasks. 

Starting with version 0.6 it also has a interactive menu to make it even easier to use ("ezh" command) 

See a video overview/demo of EZH at:  http://youtu.be/E8A9s1_i9xA

Here are some screenshots of the interactive EZH menu ("ezh" command):







The native HMC command line interface is very difficult to use for day to day tasks due to the extremely long command syntax for most commands.   Also, the native CLI requires you to specify the managed system name for any LPAR level command.   Since LPAR names are almost always unique across all the systems, this is unnecessary.  EZH LPAR level commands do not require you to specify the managed system name, and instead look it up for you.   If there are multiple LPAR's with the same name EZH will detect this and print an error. 

When you run a command with EZH it will display the corresponding HMC command line that was run.

The EZH command names are longer, however almost all of them take a single parameter - the LPAR name or Frame name.   The LPAR commands all start with "lpar" and the managed system commands start with "frame".   Because the HMC has "TAB" command line expansion, you can type "lpar" and hit TAB a couple of times and see all the LPAR level commands, or type "frame" and hit TAB a couple of times to see the Managed system level commands. 

Below are the commands that EZH supports, and the comparable native HMC command.  In each example the managed system name is "p520" and the LPAR name is "aix1". 

To start the EZH menu system, just type "ezh".

LPAR level commands, all start with "lpar".   After EZH install, type "lpar" and hit tab twice to see all commands listed
Function
EZH Command
HMC Native Command
Open a virtual terminal
lparconsole aix1
mkvterm -m p520 -p aix1
Close a virtual terminal
lparconsoleclose aix1
rmvterm -m p520 -p aix1
Show LPAR/profile info
lparinfo aix1
lssyscfg -r prof -m p520 --filter lpar_names=aix1
lssyscfg -r lpar -m p520 --filter lpar_names=aix1
Show command to re-create LPAR
(Can be used to easily clone LPAR)
lparclone aix1
No native HMC command available
Show frame an LPAR is on
lparframelookup aix1
No native HMC command available
Display list of LPAR's and Managed systems and their current state
lparls
No native HMC command available
Display list of LPAR's Entitled CPU assignements
lparlscpu
No native HMC command available
Display list of LPAR's Virtual CPU assignments
lparlsvcpu
No native HMC command available
Display list of LPAR's memory assignments
lparlsmem
No native HMC command available
Display list of LPAR's OS versions
lparlsos
No native HMC command available
Display list of LPAR's reference codes
lparlsrefcode
No native HMC command available
Display list of LPAR's running profiles names
lparlscurprof
No native HMC command available
Display list of LPAR's default profiles names
lparlsdefprof
No native HMC command available
Save running LPAR configuration to profile
lparsaveconfig aix1
mksyscfg -r prof -m p520 -o save -p aix1 -n aix1 --force
Run VIO command ("
lsmap -all" in this example)
lparviorun vio1 lsmap -all
viosvrcmd -m p520 -p vio1 -c "lsmap -all"
Power on LPAR
lparpoweron aix1

Optionally specify profile
 as second parameter
(if not uses default profile)
chsysstate -r lpar -o on -f aix1 -m p520 -n aix1
Power on LPAR to SMS
lparpoweronsms aix1

Optionally specify profile
 as second parameter
(if not uses default profile)
chsysstate -r lpar -b sms -o on -f aix1 -m p520 -n aix1
Power off LPAR - Operating System shutdown
lparshutdownos aix1
chsysstate -r lpar -o osshutdown --immed -m p520 -n aix1
Power off LPAR - hard shutdown
lparshutdownhard aix1
chsysstate -r lpar -o shutdown --immed -m p520 -n aix1
Reboot LPAR - Operating System reboot
lparrebootos aix1
chsysstate -r lpar -o osshutdown --immed --restart -m "p520" -n "aix1"
Reboot LPAR - hard reboot
lparreboothard aix1
 chsysstate -r lpar -o shutdown --immed --restart -m "p520" -n "aix1"
Delete LPAR
lpardelete aix3
rmsyscfg -r lpar -m p520 -n aix3
List LPAR system attention LED status
lparlsled aix1
lsled -m p520 -r sa -t virtuallpar --filter lpar_names=aix1
Clear LPAR system attention LED
lparclearled aix1
chled -m p520 -r sa -t virtuallpar -o off -p aix1
Display reference code on LPAR
lparrefcode aix1
lsrefcode -r lpar -m p520 -F "lpar_name refcode time_stamp" --filter lpar_names=aix1
List LPAR Virtual SCSI slots
lparvscsils aix1
lshwres -r virtualio --rsubtype scsi --level lpar -m p520 -F adapter_type,lpar_name,slot_num,remote_lpar_name,remote_slot_num  --filter "lpar_names=aix1"
List LPAR Virtual Fibre Channel slots lparfcls aix1
lshwres -r virtualio --rsubtype fc --level lpar -m p520 -F adapter_type,lpar_name,slot_num,remote_lpar_name,remote_slot_num  --filter "lpar_names=aix1"
Managed system level commands, all start with "frame".   After EZH install, type "frame" and hit tab twice to see all commands listed
Function EZH Command
HMC Native Command
List managed systems attached to HMC
framels
lssyscfg -r sys -F name
List LPAR's on a frame
framelslpar p520
lssyscfg -r lpar -m p520 -F name
Power on managed system
framepoweron p520
chsysstate -m p520 -r sys -o on
Power off managed system
framepoweroff p520
chsysstate -m p520 -r sys -o off
List attention LED status on managed system
framelsled p520
lsled -m p520 -r sa -t phys
Clear attention LED on managed system
frameclearled p520
chled -m p520 -r sa -t phys -o off
List managed system details, CPU, and memory
frameinfo p520
lssyscfg -r sys -m p520
lshwres -r proc -m p520 --level sys
lshwres -r mem -m p520 --level sys
List servicable events for a managed system
framelsevents p520
lssvcevents -t hardware -m p520 --filter status=open
List all Virtual SCSI slots on a frame
framelsvscsi
lshwres -r virtualio --rsubtype scsi --level lpar -m "p520" -F adapter_type,lpar_name,slot_num,remote_lpar_name,remote_slot_num
List all Virtual Fibre Channel slots on a frame
framelsfc
lshwres -r virtualio --rsubtype fc --level lpar -m "p520" -F adapter_type,lpar_name,slot_num,remote_lpar_name,remote_slot_num
List all frames firmware
framelsfirm
lslic -m "p520" -F ecnumber,platform_ipl_level,activated_level,deferred_level,mtms
List adapter slots
framelsslots p520
lshwres -r io --rsubtype slot -m "p520" -F "lpar_name,drc_name,description"
DLPAR Commands -
For CPU/Virtual CPU/Memory - you can specify absolute amount, or prefix with + or - to add/remove from current amount.   (i.e. specify 16 G to set LPAR to 16 GB of RAM, or specify +4G to add 4 GB to current amount of memory. )
DLPAR change CPU
dlparcpu aix1 1.5
chhwres -r proc -m "p520" -o a -p "aix1" --procunits 0.20 -w 5
DLPAR change Virtual CPU
dlparvcpu aix 2
chhwres -r proc -m "p520" -o a -p "aix1" --procs 1 -w 5
DLPAR change Memory
dlparmem aix 16G

Specify GB with "G" after number (i.e. 16G)

Specify MB with "M" after number (i.e. 512M)
chhwres -r mem -m "p520" -o a -p "aix1" -q 2048 -w 5
DLPAR add Virtual SCSI slot
dlparvscsiadd LPAR SLOT REMOTE_LPAR REMOTE_SLOT
chhwres -r virtualio -m "p520 frame" -o a -p "vio1" --rsubtype scsi -s 19 -a "adapter_type=server,remote_lpar_name="aix1",remote_slot_num=18"
DLPAR add Virtual Fibre Channel slot
dlparfcadd LPAR SLOT REMOTE_LPAR REMOTE_SLOT chhwres -r virtualio -m "p520 frame" -o a -p "vio1" --rsubtype fc -s 19 -a "adapter_type=server,remote_lpar_name="aix1",remote_slot_num=18"
DLPAR remove Virtual SCSI slot
dlparvscsirm LPAR SLOT
chhwres -r virtualio -m "p520 frame" -o r -p "vio1" --rsubtype scsi -s 19

DLPAR remove Virtual Fibre Channel slot
dlparfcrm LPAR SLOT
chhwres -r virtualio -m "p520 frame" -o r -p "vio1" --rsubtype fc -s 19
Misc. Commands
Function EZH Command HMC Native Command
Show system uptime
uptime
No native HMC command available
List running process PID's and names
ps
No native HMC command available
Show available memory/swap
free
monhmc -r mem -n 0; monhmc -r swap -n 0
Count number of lines
wc -l
No native HMC command available
Edit a file
vi
rnvi -f
Check disk usage
df
monhmc -n 0 -r disk
Change password
passwd 
OR
passwd USER
chhmcusr -u hscroot -t passwd
List users
lsuser
lshmcusr
Source a file
.
source
List LED status of all frames and LPAR's
lsledall
No native HMC command available
List open serviceable events
lsevents
lssvcevents -t hardware --filter status=open
Close all serviceable events
closeallevents
chsvcevent -o closeall
Show HMC version
hmcversion
lshmc -V
Reboot HMC
hmcrestart
hmcshutdown -t now -r
Show HMC hostname
hostname
lshmc -n -F hostname


Installation

To install, download the "ezh" script from: Sourceforge download page

Then use scp to copy the script to your home directory on the HMC (i.e.  scp ezh hscroot@192.168.0.20:)

SSH to the HMC and login as your account.   Then type "source ezh".   You will need to run this command each time you login to the HMC for the EZH commands to be available. 

Change Log


Version 1.2 (12-15-13)

Version 1.1 (2-2-13)

Version 1.0 (01-10-13)

Version 0.8 (12-08-12)

Version 0.7 (12-02-12)

Version 0.6 (11-11-12)


Version 0.4 (11-03-12)
    *New uptime command
    *New ps command to show running processes/PID's
    *New free command to show memory usage / swap usage
    *New "wc -l" command that will display line count (i.e.  "cat ezh | wc -l" shows number of lines in ezh)
    *lparpoweron and lparpoweronsms now support optional second parameter that specifies profile name (if not specified the default profile is used)


Version 0.3 (10-26-12). 
    *Miscellaneous bug fixes.
    *Supports frame names, LPAR names, and LPAR profile names with spaces in them now.
    *LPAR power on commnds now will activate the default profile rather than the last used profile.
    *Thanks to Jim Suto for code contributions in this version.

About the author / Contacting the author

Script was written by Brian Smith.  I have an IBM developerWorks blog at:  Brian's AIX/UNIX/Linux blog

You can contact me at:   ixbrian at gmail dot com

Running commands remotely over SSH using EZH

You can run EZH commands remotely over an SSH connection by using a command similiar to this (note the location of the quote marks):

ssh hscroot@hmc1 "source ezh; lparls"

License / Disclaimer

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.