Edit: I wonder if this script is still running in the wild.
Originally posted April 22, 2008 on AIXchange
I received an interesting e-mail from a mailing list. Included was this information submitted by Dean Rowswell:
1. Turn on PuTTY logging
2. Copy and paste these 6 commands first:
lshmc -v
lshmc -V
lshmc -r
lshmc -n
lshmc -b
lssysconn -r all
lssyscfg -r sys
lssyscfg -r frame
lshmc -n -F clients
cat /opt/hsc/data/.hmc/.removed
lspartition -dlpar
lspartition -sfp
3. Copy and paste these commands last:
for MANAGEDSYS in `lssyscfg -r sys -F type_model*serial_num`
do
echo “============MANAGED SYSTEM –> ${MANAGEDSYS}”
echo ” ============MANAGED SYSTEM –> LIC level”
lslic -m ${MANAGEDSYS} -t sys
echo ” ============MANAGED SYSTEM –> processor config”
lshwres -m ${MANAGEDSYS} -r proc –level sys
echo ” ============MANAGED SYSTEM –> lpar processor usage”
lshwres -m ${MANAGEDSYS} -r proc –level lpar -F
lpar_name:curr_proc_mode:curr_sharing_mode:run_proc_units:run_procs
echo ” ============MANAGED SYSTEM –> memory config”
lshwres -m ${MANAGEDSYS} -r mem –level sys
echo ” ============MANAGED SYSTEM –> lpar memory usage”
lshwres -m ${MANAGEDSYS} -r mem –level lpar -F lpar_name:run_mem
echo ” ============MANAGED SYSTEM –> lpar status”
lssyscfg -m ${MANAGEDSYS} -r lpar -F name:state
echo ” ============MANAGED SYSTEM –> cuod processor config”
lscod -m ${MANAGEDSYS} -t cap -r proc -c cuod
echo ” ============MANAGED SYSTEM –> cuod memory config”
lscod -m ${MANAGEDSYS} -t cap -r mem -c cuod
echo ” ============MANAGED SYSTEM –> drawer config”
lshwres -m ${MANAGEDSYS} -r io –rsubtype unit
echo ” ============MANAGED SYSTEM –> bus config”
lshwres -m ${MANAGEDSYS} -r io –rsubtype bus
echo ” ============MANAGED SYSTEM –> slot config”
lshwres -m ${MANAGEDSYS} -r io –rsubtype slot
echo ” ============MANAGED SYSTEM –> slot config summary”
lshwres -m ${MANAGEDSYS} -r io –rsubtype slot -F
drc_name:description:lpar_name:lpar_id
echo ” ============MANAGED SYSTEM –> virtual ethernet”
lshwres -m ${MANAGEDSYS} -r virtualio –rsubtype eth –level sys
echo ” ============MANAGED SYSTEM –> virtual ethernet all lpar”
lshwres -m ${MANAGEDSYS} -r virtualio –rsubtype eth –level lpar
echo ” ============MANAGED SYSTEM –> virtual scsi all lpar”
lshwres -m ${MANAGEDSYS} -r virtualio –rsubtype scsi –level lpar
for LPAR in `lssyscfg -r lpar -m ${MANAGEDSYS} -F name`
do
echo ” ============LPAR –> ${LPAR} –> CPU resources”
lshwres -r proc -m ${MANAGEDSYS} –level lpar –filter lpar_names=${LPAR}
echo ” ============LPAR –> ${LPAR} –> Memory resources”
lshwres -r mem -m ${MANAGEDSYS} –level lpar –filter lpar_names=${LPAR}
echo ” ============LPAR –> ${LPAR} –> Physical adapters”
lshwres -r io –rsubtype slot -m ${MANAGEDSYS} –filter lpar_names=${LPAR}
echo ” ============LPAR –> ${LPAR} –> Virtual Ethernet config”
lshwres -r virtualio –rsubtype eth –level lpar -m ${MANAGEDSYS}
–filter lpar_names=${LPAR}
echo ” ============LPAR –> ${LPAR} –> Virtual SCSI config”
lshwres -r virtualio –rsubtype scsi –level lpar -m ${MANAGEDSYS}
–filter lpar_names=${LPAR}
echo ” ============LPAR –> ${LPAR} –> LPAR config”
lssyscfg -r lpar -m ${MANAGEDSYS} –filter lpar_names=${LPAR}
echo ” ============LPAR –> ${LPAR} –> LPAR profiles”
lssyscfg -r prof -m ${MANAGEDSYS} –filter lpar_names=${LPAR}
done
done
4. Copy and paste these lines to add the information to my LPAR resource allocation spreadsheet
NOTE: when I do a paste into Excel click on the paste options and select “Text import wizard”
for MANAGEDSYS in `lssyscfg -r sys -F type_model*serial_num`
do
echo “============MANAGED SYSTEM –> ${MANAGEDSYS}”
lshwres -m ${MANAGEDSYS} -r io –rsubtype slot -F
unit_phys_loc:bus_id:phys_loc:description
done
For System p machines that already have the physical resources assigned:
for MANAGEDSYS in `lssyscfg -r sys -F type_model*serial_num`
do
echo “============MANAGED SYSTEM –> ${MANAGEDSYS}”
lshwres -m ${MANAGEDSYS} -r io –rsubtype slot -F
unit_phys_loc:bus_id:phys_loc:description:lpar_id:lpar_name
done
5. To capture any errors and events
lssvcevents -t hardware
lssvcevents -t console
After messing around with the script, I wanted to get it working from cron. I’m unable to run scripts on my HMC, but after looking here (link not active), I set up my ssh keys so I could auto login from my AIX machine to my HMC.
Then I modified the above script so I could run it from my AIX machine and have it connect to my HMC using ssh. Now I can run the job out of cron on my AIX machine instead of messing with putty.
#!/usr/bin/ksh
#
# scriptname -m hmchostname -l hmcuser
#
#
hmc=hmc.ip.address
user=hscroot
while getopts m:l: option
do
case $option in
m) hmc=”$OPTARG”;;
l) user=”$OPTARG”;;
esac
done
echo “HMC Information:”
echo “”
ssh $hmc -l $user ‘date’
ssh $hmc -l $user ‘lshmc -v’
ssh $hmc -l $user ‘lshmc -V’
ssh $hmc -l $user ‘lshmc -r’
ssh $hmc -l $user ‘lshmc -n’
ssh $hmc -l $user ‘lshmc -b’
ssh $hmc -l $user ‘lssysconn -r all’
ssh $hmc -l $user ‘lssyscfg -r sys’
ssh $hmc -l $user ‘lssyscfg -r frame’
ssh $hmc -l $user ‘lshmc -n -F clients’
ssh $hmc -l $user ‘cat /opt/hsc/data/.hmc/.removed’
ssh $hmc -l $user ‘lspartition -dlpar’
ssh $hmc -l $user ‘lspartition -sfp’
for MANAGEDSYS in `ssh $hmc -l $user “lssyscfg -r sys -F type_model*serial_num”`
do
echo “============MANAGED SYSTEM –> ${MANAGEDSYS}”
echo ” ============MANAGED SYSTEM –> LIC level”
ssh $hmc -l $user “lslic -m ${MANAGEDSYS} -t sys”
echo ” ============MANAGED SYSTEM –> processor config”
ssh $hmc -l $user “lshwres -m ${MANAGEDSYS} -r proc –level sys”
echo ” ============MANAGED SYSTEM –> lpar processor usage”
ssh $hmc -l $user “lshwres -m ${MANAGEDSYS} -r proc –level lpar -F
lpar_name:curr_proc_mode:curr_sharing_mode:run_proc_units:run_procs”
echo ” ============MANAGED SYSTEM –> memory config”
ssh $hmc -l $user “lshwres -m ${MANAGEDSYS} -r mem –level sys”
echo ” ============MANAGED SYSTEM –> lpar memory usage”
ssh $hmc -l $user “lshwres -m ${MANAGEDSYS} -r mem –level lpar -F
lpar_name:run_mem”
echo ” ============MANAGED SYSTEM –> lpar status”
ssh $hmc -l $user “lssyscfg -m ${MANAGEDSYS} -r lpar -F name:state”
echo ” ============MANAGED SYSTEM –> cuod processor config”
ssh $hmc -l $user “lscod -m ${MANAGEDSYS} -t cap -r proc -c cuod”
echo ” ============MANAGED SYSTEM –> cuod memory config”
ssh $hmc -l $user “lscod -m ${MANAGEDSYS} -t cap -r mem -c cuod”
echo ” ============MANAGED SYSTEM –> drawer config”
ssh $hmc -l $user “lshwres -m ${MANAGEDSYS} -r io –rsubtype unit”
echo ” ============MANAGED SYSTEM –> bus config”
ssh $hmc -l $user “lshwres -m ${MANAGEDSYS} -r io –rsubtype bus”
echo ” ============MANAGED SYSTEM –> slot config”
ssh $hmc -l $user “lshwres -m ${MANAGEDSYS} -r io –rsubtype slot”
echo ” ============MANAGED SYSTEM –> slot config summary”
ssh $hmc -l $user “lshwres -m ${MANAGEDSYS} -r io –rsubtype slot -F
drc_name:description:lpar_name:lpar_id”
echo ” ============MANAGED SYSTEM –> virtual ethernet”
ssh $hmc -l $user “lshwres -m ${MANAGEDSYS} -r virtualio –rsubtype
eth –level sys”
echo ” ============MANAGED SYSTEM –> virtual ethernet all lpar”
ssh $hmc -l $user “lshwres -m ${MANAGEDSYS} -r virtualio –rsubtype
eth –level lpar”
echo ” ============MANAGED SYSTEM –> virtual scsi all lpar”
ssh $hmc -l $user “lshwres -m ${MANAGEDSYS} -r virtualio –rsubtype
scsi –level lpar”
for LPAR in `ssh $hmc -l $user “lssyscfg -r lpar -m ${MANAGEDSYS} -F name”`
do
echo ” ============LPAR –> ${LPAR} –> CPU resources”
ssh $hmc -l $user “lshwres -r proc -m ${MANAGEDSYS} –level lpar
–filter lpar_names=${LPAR}”
echo ” ============LPAR –> ${LPAR} –> Memory resources”
ssh $hmc -l $user “lshwres -r mem -m ${MANAGEDSYS} –level lpar
–filter lpar_names=${LPAR}”
echo ” ============LPAR –> ${LPAR} –> Physical adapters”
ssh $hmc -l $user “lshwres -r io –rsubtype slot -m ${MANAGEDSYS}
–filter lpar_names=${LPAR}”
echo ” ============LPAR –> ${LPAR} –> Virtual Ethernet config”
ssh $hmc -l $user “lshwres -r virtualio –rsubtype eth –level lpar -m
${MANAGEDSYS} –filter lpar_names=${LPAR}”
echo ” ============LPAR –> ${LPAR} –> Virtual SCSI config”
ssh $hmc -l $user “lshwres -r virtualio –rsubtype scsi –level lpar
-m ${MANAGEDSYS} –filter lpar_names=${LPAR}”
echo ” ============LPAR –> ${LPAR} –> LPAR config”
ssh $hmc -l $user “lssyscfg -r lpar -m ${MANAGEDSYS} –filter
lpar_names=${LPAR}”
echo ” ============LPAR –> ${LPAR} –> LPAR profiles”
ssh $hmc -l $user “lssyscfg -r prof -m ${MANAGEDSYS} –filter
lpar_names=${LPAR}”
done
done
for MANAGEDSYS in `ssh $hmc -l $user “lssyscfg -r sys -F type_model*serial_num”`
do
echo “============MANAGED SYSTEM –> ${MANAGEDSYS}”
ssh $hmc -l $user “lshwres -m ${MANAGEDSYS} -r io –rsubtype slot -F
unit_phys_loc:bus_id:phys_loc:description”
done
for MANAGEDSYS in `ssh $hmc -l $user “lssyscfg -r sys -F type_model*serial_num”`
do
echo “============MANAGED SYSTEM –> ${MANAGEDSYS}”
ssh $hmc -l $user “lshwres -m ${MANAGEDSYS} -r io –rsubtype slot -F
unit_phys_loc:bus_id:phys_loc:description:lpar_id:lpar_name”
done
ssh $hmc -l $user ‘lssvcevents -t hardware’
ssh $hmc -l $user ‘lssvcevents -t console’
Feel free to improve upon what Dean and I have done so far. I’ll add your contribution to a future posting.