#!/usr/bin/ksh93 ################################################################ SSHUSER="s45x" HMCMACH="ddclphmc01" for i in $( ssh ${SSHUSER}@${HMCMACH} lssyscfg -r sys -F name ); do SYS="${i//[!A-Za-z0-9]/}" print "Gathering SCSI virtual I/O info for ${SYS}" ssh ${SSHUSER}@${HMCMACH} lshwres -r virtualio --rsubtype scsi -m ${i} --level lpar >> "/tmp/tmp${$}.out" sort -n < "/tmp/tmp${$}.out" > "${SYS}.virtscsi.out" rm -f "/tmp/tmp${$}.out" done COLOR=( white red green blue yellow cyan magenta lightred lightblue lightgreen ) ICNT="0" for FNAME in Server*.virtscsi.out do unset LPAR SYSNAME[ICNT]="${FNAME%%.*}" SYS="${SYSNAME[ICNT++]//[!A-Za-z0-9]/}" sed -e "s/\".*\"//g;s/=/=\"/g;s/,,*/\";/g;s/$/\"/g" "${FNAME}" | while read -r -- ATTRLINE do eval ${ATTRLINE} drc_index="${slot_num}" eval unset ${SYS}_${drc_index} eval typeset -A ${SYS}_${drc_index} IFS=";" for i in ${ATTRLINE} do eval ${i} print "${SYS}_${drc_index}[${i%%=*}]=${i##*=}" eval eval ${SYS}_${drc_index}[\${i%%=*}]="\"\${i##*=}\"" done eval ${SYS}_index[SCNT++]="\"\${drc_index}\"" eval LPAR[LCNT++]="\"\${${SYS}_${drc_index}[lpar_name]}\"" if [[ "_${LPAR[LCNT-1]}" != "_" ]] then OUTFILE="${LPAR[LCNT-1]}.virtualscsi.html" exec 4>"${OUTFILE}" print -u 4 "\n" print -u 4 "\n


" eval print -u 4 "\"\n

\${${SYS}_${drc_index}[lpar_name]}

\"" print -u 4 "\n

" exec 4>&- fi IFS=$' \t\n' done MCNT="0" eval typeset -A ${SYS}_LCOLOR eval ${SYS}_LCOLOR[NULL]="${COLOR[MCNT]}" for LNAME in "${LPAR[@]}" do print "${LNAME}" done | sort | uniq | while read -- MNAME do [[ "_${MNAME}" != "_" ]] && eval ${SYS}_LCOLOR[\${MNAME}]="\"\${COLOR[++MCNT]}\"" done done exec 3>virtualscsi.content.shtml ICNT="0" for SYS in "${SYSNAME[@]}" do SYS="${SYS//[!A-Za-z0-9]/}" print "\n\n${SYS}" print -u 3 "\n" print -u 3 "\n


" print -u 3 "\n

${SYS}

" print -u 3 "\n

" eval INDEX="( \${${SYS}_index[@]} )" print "Drawer Serial,Bus,Slot,Adapter,LPAR" print -u 3 "

" print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 "

" for IDX in "${INDEX[@]}" do eval OUTPUT="\"\${${SYS}_${IDX}[adapter_type]}\",\ \"\${${SYS}_${IDX}[slot_num]}\",\ \"\${${SYS}_${IDX}[remote_lpar_name]}\",\ \"\${${SYS}_${IDX}[remote_slot_num]}\",\ \"\${${SYS}_${IDX}[backing_devices]}\",\ \"\${${SYS}_${IDX}[lpar_name]}\"" # print "${OUTPUT}" eval BGCOLOR="\"\${${SYS}_LCOLOR[\${${SYS}_${IDX}[lpar_name]}]}\"" [[ "_${DESC}" = _[Ee]mpty* ]] && BGCOLOR="grey" [[ "_${BGCOLOR}" = "_" ]] && BGCOLOR="white" print -u 3 "

" print -u 3 "

" # print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " eval OUTFILE="\"\${${SYS}_${IDX}[lpar_name]}\"" if [[ "_${OUTFILE}" != "_" ]] then OUTFILE="${OUTFILE}.virtualscsi.html" print -u 3 " " exec 4>>"${OUTFILE}" print -u 4 "

" print -u 4 "

" print -u 4 " " print -u 4 " " print -u 4 " " print -u 4 " " print -u 4 " " print -u 4 " " print -u 4 " " print -u 4 "

" exec 4>&- else print -u 3 " " fi print -u 3 " " print -u 3 "

" done print -u 3 "
Adapter TypeSlotRemote LPARRemote SlotBacking DeviceLPAR Name
" # eval print -u 3 "\"\${${SYS}_${IDX}[lpar_name]}\"" # print -u 3 " " eval print -u 3 "\"\${${SYS}_${IDX}[adapter_type]}\"" print -u 3 " " eval print -u 3 "\"\${${SYS}_${IDX}[slot_num]}\"" print -u 3 " " eval print -u 3 "\"\${${SYS}_${IDX}[remote_lpar_name]}\"" print -u 3 " " eval print -u 3 "\"\${${SYS}_${IDX}[remote_slot_num]}\"" print -u 3 " " eval print -u 3 "\"\${${SYS}_${IDX}[backing_devices]}\"" print -u 3 " " print -u 3 " " eval print -u 3 "\"\${${SYS}_${IDX}[lpar_name]}\"" print -u 3 " " print -u 3 "
" eval print -u 4 "\"\${${SYS}_${IDX}[adapter_type]}\"" print -u 4 " " eval print -u 4 "\"\${${SYS}_${IDX}[slot_num]}\"" print -u 4 " " eval print -u 4 "\"\${${SYS}_${IDX}[remote_lpar_name]}\"" print -u 4 " " eval print -u 4 "\"\${${SYS}_${IDX}[remote_slot_num]}\"" print -u 4 " " eval print -u 4 "\"\${${SYS}_${IDX}[backing_devices]}\"" print -u 4 " " eval print -u 4 "\"\${${SYS}_${IDX}[lpar_name]}\"" print -u 4 "
" print -u 3 " " print -u 3 "

" done exec 3>&- # # End the HTML code for each LPAR file # for SYS in "${SYSNAME[@]}" do SYS="${SYS//[!A-Za-z0-9]/}" eval INDEX="( \${${SYS}_index[@]} )" for IDX in "${INDEX[@]}" do eval print "\"\${${SYS}_${IDX}[lpar_name]}\"" done > /tmp/${$}.out sort /tmp/${$}.out | uniq | while read -- MNAME do if [[ "_${MNAME}" != "_" ]] then OUTFILE="${MNAME}.virtualscsi.html" exec 4>>"${OUTFILE}" print -u 4 "

" exec 4>&- fi done rm -f /tmp/${$}.out done