Extracting Resource Allocation Data for Chargeback in a HP Virtual Server Environment for HP Integrity Servers

In this output, note that the Owned value for the policy can be determined. In cases where the GUI
reports only a minimum and maximum value, the gwlmreport output includes an Owned value that
is equal to the minimum value. Note also that many more policies might be defined and listed than
those shown to be actually in use.
The following simple script uses the output of gwlmreport config to first identify workloads that
are part of SRDs, then to identify the matching policy and print its owned value:
CMS # cat ./wkldguargwlm.sh
GWLMCONFIGFILE=/tmp/gwlmreport.config.out
SRDWKLDSFILE=/tmp/gwlmreport.config.srdwklds.out
WRKLDOWNEDFILE=/tmp/gwlmreport.config.wkldowned.out
gwlmreport config > $GWLMCONFIGFILE
cat $GWLMCONFIGFILE | awk '/SRDs/,/EOF/' | grep -v "####" | \
grep -E "^ Workload|^ Policy" | sed 's/ - / /g' | sed
's/:/ /g' | \
awk '{ if (match($1,"Workload")) {printf "%s ",$2} if
(match($1,"Policy")) {print $2}}' \
> $SRDWKLDSFILE
cat $GWLMCONFIGFILE | awk '/Policies/,/Workloads/' | grep -v "####"
| \
awk -v RS="" '{printf "%s %s\n", $3,$16}' | sed 's/,/ /' >
$WRKLDOWNEDFILE
for w in `cat $SRDWKLDSFILE | awk '{print $1}'`; do
printf "%s " $w
WKLDPLCY=`cat $SRDWKLDSFILE | grep $w | awk '{print $2}'`
grep $WKLDPLCY $WRKLDOWNEDFILE | awk '{print $2}'
done
rm $GWLMCONFIGFILE $SRDWKLDSFILE $WRKLDOWNEDFILE
CMS #
This script produces the following output:
CMS # ./wkldguargwlm.sh
Generating historical config report.
Please be patient. This may take several minutes.
va00np10.zko.hp.com 1.0
va00np00.zko.hp.com 1.0
sales-va02cm 0.5
va02cm.zko.hp.com.OTHER 1.0
finance-va02cm 0.5
va01sv.zko.hp.com.OTHER 2.0
vmwin1 0.5
vmhpux2 1.0
vmhpux1 1.0
va00vm00.zko.hp.com 0.5
CMS #
31