Import rest of modules.
This commit is contained in:
parent
02fa10f33c
commit
3f225ced9b
39 changed files with 2056 additions and 0 deletions
28
vmware/files/scripts/vmware-list
Executable file
28
vmware/files/scripts/vmware-list
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /usr/local/lib/vmware.sh
|
||||
|
||||
if [ "$1" != "-h" ]; then
|
||||
echo "Name ID Mem(MiB) VCPUs State"
|
||||
fi
|
||||
list_vms | while read vm ; do
|
||||
vmname="`echo ${vm} | cut -d '|' -f 2`"
|
||||
vmid=`echo ${vm} | cut -d '|' -f 1`
|
||||
printf '%-25s %5s' ${vmname} ${vmid}
|
||||
vmware-vim-cmd vmsvc/get.summary ${vmid} | \
|
||||
sed -n 's/^[ ]*\(powerState\|memorySizeMB\|numCpu\) = \(.*\),[ ]*$/\1 \2/p' | \
|
||||
awk '
|
||||
{
|
||||
if ($1 == "powerState") {
|
||||
power=substr($2, 2, length($2)-2)
|
||||
} else if ($1 == "memorySizeMB") {
|
||||
memory=$2
|
||||
} else if ($1 == "numCpu") {
|
||||
cpus=$2
|
||||
}
|
||||
}
|
||||
END {
|
||||
printf "%9s %5s %s\n", memory, cpus, power
|
||||
}
|
||||
'
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue