Extracting Resource Allocation Data for Chargeback in a HP Virtual Server Environment for HP Integrity Servers
for i in `mxquery -e "All nPartition Servers" | grep "^DeviceName" 
| awk '{print $2}'`; do 
 printf "%s " $i 
 let CMEM=0 
 for n in `mxquery -e "All nPartitions" | awk -v RS="" '{ 
printf "%s %s\n",$34,$12}' | grep $i | awk '{print $2}'`; do 
 let NMEM=`mxreport -e -n -S $n "Inventory - 
Servers" -x CSV | sed 's/\"//g' | grep "^$n" | awk -v FS="," 
'{print $6}'` 
 let CMEM="$CMEM + $NMEM" 
 done 
 let ULMEM=`mxexec -t "remote icapstatus" -n $n | grep 
"Amount of memory without usage rights" | awk '{print $7}'` 
 let CMEM="$CMEM/(1024*1024)" 
 let LMEM="$CMEM - $ULMEM" 
 printf " Physical Mem %d GB Mem with usage rights %d GB\n" 
$CMEM $LMEM 
done 
CMS # 
This command produces the following output: 
CMS # ./cmplxmem_icap.sh 
va00-cplx_USE4452HL6 Physical Mem 31 GB Mem with usage rights 31 
GB 
CMS # 
55 










