Wednesday, March 28, 2012

How to query a virtual machine from the command line

To quickly get information, an administrator can use the vim-cmd vmsvc/get.summary command:

Here are some examples:

Step # 1: Get information about all the existing vms and select the identifier of one of them

# vim-cmd vmsvc/getallvms

Step # 2: Find out how many cpus a virtual machine has

# vim-cmd vmsvc/get.summary 1 | grep numCpu

Step # 3: Find out how much memory was allocated to a virtual machine

# vim-cmd vmsvc/get.summary 1 | grep memorySize

Step # 4: Find out if vmware tools is installed

# vim-cmd vmsvc/get.summary 1 | grep toolsStatus

Step # 5: Find out how many network cards were allocated to a virtual machine

# vim-cmd vmsvc/get.summary 1 | grep numEthernetCards

Step # 6: Find out how many virtual disks a virtual machine has

# vim-cmd vmsvc/get.summary 1 | grep numVirtualDisks

Step # 7: Find out if a virtual machine has a cpu reservation

# vim-cmd vmsvc/get.summary 1 | grep cpuReservation

Step # 8: Find out if a virtual machine has a memory reservation

# vim-cmd vmsvc/get.summary 1 | grep memoryReservation

Step # 9: Find out the name of a virtual machine

# vim-cmd vmsvc/get.summary 1 | grep name

Step # 10: Find out if the virtual machine has been configured for fault tolerance

# vim-cmd vmsvc/get.summary 1 | grep faultTolerance

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.