Tuesday 30 May 2017

HMC commands

1) HMC Information

Command Description
lshmc -v Shows vital product data, such as the serial number.
lshmc -V Shows the release of the HMC.
lshmc -n Shows network information of the HMC
lssysconn -r all Show the connected managed systems
monhmc -r disk Look at the filesystems of the HMC. Try using "proc", "mem" and "swap as well.
ls -al /var/hsc/log/hmclogger.log ls -al /var/hsc/log/cimserver.log Intersting log files of the HMC
vtmenu Open a virtual console from the HMC. Exit by typing "~." (tilde dot) or "~~." (tilde tilde dot).
hmcshutdown -t now -r Reboot the HMC
chhmcusr -u hscroot -t passwd change the HMC password (of user hscroot)
Add an SSH key for remote access for hscroot mkauthkeys -a "public key"Use the public key found in the users .ssh directory for public key (i.e. the contents of the file ~/.ssh/id_rsa.pub). mkauthkeys -u user -a "public key"
2) Managed system and LPAR related commands: lssyscfg -r sys -F name | grep umfrm1                          shows the full name of the managed system (what we can use in other commands)
lssyscfg -r lpar -m -F name                  shows the full name of the lpars of the managed system
lssyscfg -r sys -m -F name,state --header    shows the state of the managed system
lssyscfg -r lpar -m -F name,state --header   shows the state of the lpars of the managed system
lssyscfg -r prof -m aix10-SN0603C6H --filter "lpar_names=umfrm2" -F name,boot_mode   it will show the boot mode in the profile
lssyscfg -r prof -m -F lpar_name,virtual_eth_adapters                     shows LPARS with ethernet adaptesr and VLAN tags

lshwres -r mem -m --level sys                shows memory information of the managed system
lshwres -r mem -m --level lpar               shows memory information of lpars of the managed system
lshwres -r proc -m --level sys               shows processor information of the managed system
lshwres -r proc -m --level lpar              shows processor information of lpars of the manage system
lshwres -r io -m --rsubtype slot             shows IO slot information
lshwres -r proc -m --level sys -F installed_sys_proc_units:configurable_sys_proc_units

lshwres -r virtualio --rsubtype scsi -m --level lpar               lists scsi devices by LPAR
lshwres -r virtualio --rsubtype eth -m --level lpar                lists virt. eth. devices by LPAR
lshwres -r virtualio --rsubtype eth -m --level lpar -F lpar_name,port_vlan_id

chsysstate -m -o standby -r sys              power on a system to standby
chsysstate -r sys -m -o off                  normal power off the managed system
chsysstate -r sys -m -o off --immed          fast power off the managed system

chsysstate -m -r lpar -n -o shutdown --restart          it will reboot an lpar with dump
chsysstate -m -r lpar -n -o shutdown --immed --restart  it will reboot an lpar immediately (without dump)
chsysstate -m -r lpar -n -o shutdown --immed            it will shutdown the oprating system
chsysstate -m aix10-SN65158BE -o on -r lpar -n aix10 -f default                     it will activate an lpar

mksyscfg -r prof -m -o save -p -n --force      it overwrites profile with actual running config

lspartition -dlpar                                            shows dlpar capable partitions
                                                              (it will show if RMC connection is OK between the HMC and LPAR)

lssysconn -r all                                              to see what IPs are assigned by the HMC
mksysconn -o auto                                             tells HMC to re-discover all servers' IP address

3. Console Information

lssvcevents -t console -d 60                                  lists console events in the past 60 days
lssvcevents -t hardware -d 0                                  list serviceable events which occured today
lssvcevents -t console -d 300 | grep DLPAR                    list DLPAR operations of last 300 days (you can grep more to mem or proc)
lssvcevents -t console -d 7 | grep Migration                  list last 7 days LPMs

4.opening/closing virtual terminal from hmc:

lssyscfg -r sys -F name                         <--get managed="" name="" p="" system="">lssyscfg -r lpar -m -F name    <--get lpar="" name="" p="">
mkvterm -m -p           <--opens a="" p="" terminal="" window="">rmvterm -m -p           <--closes a="" nbsp="" p="" terminal="" window="">
~~.                                             <--logout aix="" from="" leave="" necessary="" not="" p="" session="" te="" to="">

5. Show Status and LED/LCD Display of an LPAR


lsrefcode -m pserver -r lpar --filter "lpar_names=mylpar" -F lpar_name:refcode

You can even see the history of LED codes. Just use -n for the last NUM codes. For example, if you want to see the last 5 LED codes of an LPAR type

hscroot@umhmc> lsrefcode -m pserver -r lpar --filter "lpar_names=mylpar"  -n 5 -F lpar_name:refcode
mylpar:
mylpar:0c33
mylpar:
mylpar:0539
mylpar:0538
... and for the status LEDs:

hscroot@umhmc> lsled -m pserver -r sa -t virtuallpar --filter ""lpar_names=mylpar""

6. Scripts:


ssh hscroot@umhmc# 'for i in `lssyscfg -r sys -F name`;do echo $i;lssyscfg -r lpar -m $i -F name|grep ;echo;done' <--shows given="" lpar="" man.="" of="" p="" ssh="" system="" via="">
for i in `lssyscfg -r sys -F name`;do lssyscfg -r prof -m $i -F lpar_name,virtual_eth_adapters | grep vio | grep ;echo; done <--shows p="" spec.="" vlan="">
for sys in `lssyscfg -r sys -F name`; do for vio in `lssyscfg -r lpar -m $sys -F name,lpar_env | grep vioserver | cut -f 1 -d, | sort`; do echo $vio; viosvrcmd -m $sys -p $vio -c ; done; done <--runs a="" command="" on="" p="" servers="" vios="">

No comments:

Post a Comment