AHV - count how many vCPU use in one node
count how many vCPU used with power on VM in one node
vCPU used = vCPU * core
(the result do not containt CVM core)
_________________________________________
vCPU used = vCPU * core
(the result do not containt CVM core)
#!/bin/bash
total="0"
VM=(`virsh list |
gawk -F' ' '{printf("%s\n",$2);}'|awk 'NR>3{print p}{p=$0}'`)
for i in ${VM[@]};
do
vmcore="$(acli vm.get $i |grep
"num_cores_per_vcpu" | cut -d":" -f 2)"
vmcpu="$(acli vm.get $i |grep
"num_vcpus" | cut -d":" -f 2)"
vmcpu=$((vmcore * vmcpu))
total=$((total + vmcpu))
done
echo $total
_________________________________________
留言
張貼留言