I’m fairly used to working with the esxcfg/vicfg commands through working with ESX and vMA, but since vSphere 5 came along I’m increasingly aware of esxcli as a tool for troubleshooting ESX hosts. Esxcli has been around since before vSphere 5, but with the release of the new platform it got quite a revamp – so it’s as good a time as any for me to have a look at what I can do with esxcli that I would perhaps normally do with esxcfg-*. There are several ways to access esxcli including local esxcli or remotely using vMA, vCLI or PowerCLI, though the examples I use here will be using esxcli over an SSH connection to a host.
Esxcli uses the concept of namespaces to organise it’s commands, many of which are new with vSphere 5. To get a quick overview of the available namespaces type ‘esxcli’ at the esxi command prompt:
An esxcli command is constructed using these namespaces, for example, esxcli storage nmp device list will list all storage devices:
Whilst running esxcli storage core adapter rescan –all will rescan all storage adapters on a host. You can see available options under the storage namespace by running esxcli storage. You can also get help information at any stage by running, for example, esxcli storage –help and a complete list of namespaces can be accessed by running esxcli esxcli command list.
After spending a little time working with esxcli its easy to see why it has been chosen to replace the esxcfg-* commands. It’s intuitive, making it fairly easy to work out how to do something without having to refer back to documentation. In future posts I’ll look further into some of the namespaces view a view to replacing the esxcfg commands I use regularly with their esxcli counterparts.