Monday, December 15, 2008

VMware ESXi Infrastructure Client Issues

Because of the appliance like nature of VMware ESXi there is not a lot that can be done when something goes wrong. In a lot of cases if something stops functioning correctly the only choice is to reboot the system with the risk of loosing settings and suffering downtime.

If you have enabled SSH on your VMware ESXi hypervisor and are having issues with the Infractructure client you can restart the management agents through the CLI to regain "control" of the system. If your Infrastructure client is unable to login or if your getting strange activities or error messages you probably need to restart the management agents. The following steps can be used to do this.

Login to system using SSH

Run the dcui program (if your terminal is not big enough it WILL segfault)

Authenticate to the dcui console program

Select restart management agents

You should now be able to log in and any issues that you were seeing before with the Infrastructure Client should go away.

UPDATE: On rare occasions this process does not work. In those cases these instructions are somewhat helpful on how to regain control of your VMware ESXi host

Wednesday, December 10, 2008

VMware ESXi SSH CLI commands

One of the biggest challenges I run into working with ESXi hosts is the lack of a real usable CLI. The remote CLI provided by VMware is clunky at best and makes administration a bit of a pain. I did some poking around and managed to find some interesting CLI commands that work for ESXi.

Most of these have no manual page but will output a help message if run by themselves. I would recommend using extreme caution and using a test host to determine the usefulness in your environment before using them on an important system. Also keep in mind that the examples that I give are not the "only" way the commands can be used.

vim-cmd vmsvc/getallvms
Lists all vm's running on hypervisor and provides vmid

vim-cmd vmsvc/power.off vmid
Powers off vmid referenced from getallvms command

vim-cmd vmsvc/power.on vmid
Powers off vmid referenced from getallvms command

vim-cmd vmsvc/power.reboot vmid
Reboots vmid referenced from getallvms command

vim-cmd vmsvc/destroy vmid
Deletes the vmdk and vmx files from disk

vim-cmd hostsvc/maintenance_mode_enter
Puts hypervisor into maintenance mode

vim-cmd hostsvc/maintenance_mode_exit
Takes hypervisor out of maintenance mode

vim-cmd solo/registervm /vmfs/vol/datastore/dir/vm.vmx
Registers vm in hypervisor inventory

vim-cmd vmsvc/unregister vmid
Unregisters vm with hypervisor

vim-cmd vmsvc/tools.install vmid
Starts vmware tools installation for VM

vim-cmd hostsvc/net/info
Provides information about hypervisor networking

chkconfig -l
Shows daemons running on hypervisor. Can also be used for configuration.

esxtop
Same as linux top for vmware

vmkerrcode -l
List of vmkernel errors

esxcfg-info
Lists a LOT of information about the esx host

esxcfg-nics -l
Lists information about NIC's. Can also be used for configuration.

esxcfg-vswitch -l
Lists information about virtual switching. Can also be used for configuration.

dcui
Provides console screen to ssh session

vsish
Vmware interactive shell

decodeSel /var/log/ipmi_sel.raw
Read System Event Log of server