#!/usr/bin/ksh93 ################################################################ SSHUSER="s45x" HMCMACH="dallphmc01" for i in $( ssh ${SSHUSER}@${HMCMACH} lssyscfg -r sys -F name ); do SYS="${i[ICNT++]//[!A-Za-z0-9]/}" ssh ${SSHUSER}@${HMCMACH} lshwres -r io --rsubtype slot -m ${i} > ${SYS}.lshwres.out done COLOR=( white red green blue yellow cyan magenta lightred lightblue lightgreen ) ICNT="0" for FNAME in Server*.lshwres.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} eval unset ${SYS}_${drc_index} eval typeset -A ${SYS}_${drc_index} IFS=";" for i in ${ATTRLINE} do 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="${SYS}_${LPAR[LCNT-1]}.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>tmp.html 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 "

" for IDX in "${INDEX[@]}" do eval OUTPUT="\"\${${SYS}_${IDX}[unit_phys_loc]}\",\ \"\${${SYS}_${IDX}[bus_id]}\",\ \"\${${SYS}_${IDX}[phys_loc]}\",\ \"\${${SYS}_${IDX}[description]}\",\ \"\${${SYS}_${IDX}[lpar_name]}\"" # print "${OUTPUT}" eval DESC="\"\${${SYS}_${IDX}[description]}\"" 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 " " eval OUTFILE="\"\${${SYS}_${IDX}[lpar_name]}\"" if [[ "_${OUTFILE}" != "_" ]] then OUTFILE="${SYS}_${OUTFILE}.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 "

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

" done print -u 3 "
Drawer SerialBusSlotAdapterLPAR
" eval print -u 3 "\"\${${SYS}_${IDX}[unit_phys_loc]}\"" print -u 3 " " eval print -u 3 "\"\${${SYS}_${IDX}[bus_id]}\"" print -u 3 " " eval print -u 3 "\"\${${SYS}_${IDX}[phys_loc]}\"" print -u 3 " " eval print -u 3 "\"\${${SYS}_${IDX}[description]}\"" 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}[unit_phys_loc]}\"" print -u 4 " " eval print -u 4 "\"\${${SYS}_${IDX}[bus_id]}\"" print -u 4 " " eval print -u 4 "\"\${${SYS}_${IDX}[phys_loc]}\"" print -u 4 " " eval print -u 4 "\"\${${SYS}_${IDX}[description]}\"" 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="${SYS}_${MNAME}.html" exec 4>>"${OUTFILE}" print -u 4 "

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