Top ESXi commands for troubleshooting
Running commands to manage and troubleshoot ESXi host is considered as preferred way. When we need to troubleshoot an ESXi host during an issue we need to run specific commands in order to interpret logs like vmkernel, hostd etc. There are many commands that are for the same purpose but in this blog we will discuss about some useful commands that can be really helpful in troubleshooting as well.
As you all know there are logs in ESXi host for every operation that ESXi performs, let us first know about important logs in ESXi that are used for troubleshooting:
Above are the logs that are very helpful in troubleshooting any issue with VMs or ESXi host. Now to interpret these logs there must be some commands that we need to use for analysis. Such shell commands are given below:
These commands are used to find a specific files or text with in the log file. cat is used to simply display the contents of a file, while grep can be used to search for specific text within a single or group of files
find /path/to/vm/folder –iname “*delta*” – list all delta disks of a VM.
cat hostd.log | grep error – search occurrences of “error” within the hostd.log
While the ‘cat’ command is great for displaying the complete contents of a file, head and tail can be used to show either just the beginning or end part of the file, skipping the contents in the middle. tail can be extremely useful in times of troubleshooting, especially when specifying the ‘-f’ flag to monitor log files in real time.
tail -f /var/log/vmkernel.log – watch the vmkernel log in real time
The less command becomes extremely useful when you are displaying the contents of large files. By piping (‘|’) your cat output to less, you are able to have the system page the output, allowing us to scroll through the output, both up and down through the file.
cat /var/log/vpxa.log | less – output vpxa.log to the screen with a paging fashion.
These two commands deal with presenting information about free space within ESXi file systems, which are used to see space consumed with in ESXi host.
All the ESXi services are handled by services.sh command:
services.sh restart – restart all ESXi services.
The scripts located in /etc/init.d can be used to start/stop their respective services one at a time. If you just wanted to restart the vCenter Server Agent (also known as the vpxa service), you could run /etc/init.d/vpxa restart to restart it.
Similar to ping but it is ESXi specific command to ping the vmkernel interfaces
This command is used to manage VMFS volumes and virtual disks via the command line.
Used to troubleshoot the performance of the ESXi host in terms of CPU, DISK , Memory, Network.
It is used to generate the ESXi log bundle when required by VMware vendor.
There are other command line utilities as well bundled with ESXi like vim-svc,esxcli etc, we will discuss about them in another blog.
Source: SearchServerVirtualization Blog