The following script will reprocess and reorder the DISK* fields in the NMON data from the "csv" files. This script specifically grabs the lines of data beginning with "DISK" from the "csv" file and removes those disks which are NOT "Tru-copied" or VPATH disks. The Tru-Copy disks are identified as being part of the volume groups labeled 100 or higher.
#!/usr/bin/ksh93
################################################################
MACHNAME="${1:?ERROR: machine name not specified}"
DATE="${2:?ERROR: date string not specified}"
DISKLIST=${DISKLIST:-$( rsh ${MACHNAME} "for VPATH in \$( lspv | egrep -iv \"None|orabackupvg\" | grep -v \"egate1[0-9][0-9]\" | grep \"vpath\" | awk '{ print \$1 }' ); do lsvpcfg \${VPATH} | awk '{ print \$7, \$10 }' | grep \"hdisk\"; done" )}
egrep -v "^TOP,|^CPU" /usr/local/httpd/htdocs/nmon/${MACHNAME}/csv/${MACHNAME}_${DATE}_000[0-9].nmon.csv > /tmp/tmp0${$}.csv
grep "^DISK" /tmp/tmp0${$}.csv | awk -F, '{ print $1 }' | sort | uniq
for DISKPARM in $( grep "^DISK" /tmp/tmp0${$}.csv | awk -F, '{ print $1 }' | sort | uniq )
do
print "Working on ${MACHNAME}:${DATE}:${DISKPARM}..."
IFS=","
HEADER=$( grep "^${DISKPARM}," /tmp/tmp0${$}.csv | head -1 )
FIELDID=( NULL, ${HEADER} )
FIELDS='${1},${2}'
FIELDS=''
IFS=$' \t\n'
for HDISK in ${DISKLIST}
do
[[ "_${HDISK}" = "_" ]] && continue
ICNT=0
for FIELD in "${FIELDID[@]}"
do
if [[ "_${FIELD}" = "_${HDISK}" ]]
then
FIELDS="${FIELDS},\${${ICNT}}"
break
fi
(( ++ICNT ))
done
done
FIELDS="\${1},\${2}${FIELDS}"
# print "fields = ${FIELDS}"
# exit
IFS=$' \t\n'
cp /tmp/tmp0${$}.csv /tmp/tmp1${$}.csv
while read LINE
do
if echo "${LINE}" | grep "^${DISKPARM}," > /dev/null 2>&1
then
IFS=","
set -- ${LINE}
IFS=$' \t\n'
eval NEWLINE="\"${FIELDS}\""
print "${LINE}" | sed -e "s|${LINE}|${NEWLINE}|g"
else
print "${LINE}"
fi
done < /tmp/tmp1${$}.csv > /tmp/tmp0${$}.csv
done
cp /tmp/tmp0${$}.csv /usr/local/httpd/htdocs/nmon/${MACHNAME}/csv/${MACHNAME}_${DATE}_0000.nmon.tc.csv