Using ESXTOP and RESXTOP to Obtain Performance Metrics

Using ESXTOP and RESXTOP to Obtain Performance Metrics

July 24, 2012 1 By Eric Shanks

Sometimes we need a quick set of statistics to see what is going on inside a vSphere host.  Sort of like using Microsoft’s task manager on a Windows server, we can quickly take a look at what some performance stats on the VMware hosts.  A couple of the tools to do this are the esxtop and resxtop commands.

Esxtop and resxtop are basically the same with the exception that esxtop must be run directly on the vSphere host by connecting via SSH.  Resxtop can be run remotely from the vMA perhaps.  Below is a screenshot of the two tools running side by side.  Aside from the refresh rates not being matched up, you can see that they are both showing the same information.

On the left is the esxtop and on the right the resxtop.

Once you’ve picked your method of logon, just run the esxtop or resxtop command to bring up the statistics.  By default, it will show the CPU information in Interactive mode.  To change what metrics you are looking at, you can press keys on your keyboard.  If you hit the “h” key it will display the help which will allow you to see your other options.

As you can see you can also select:

c: CPU

i:interrupt

m: memory

n:network

d: disk adapter

u: disk device

v:disk VM

p: power mgmt

For a description of each of the metrics I would suggest taking a look at Duncan Epping’s blog.  He has put a lot of great information about esxtop on his site which comes in very handy.  http://www.yellow-bricks.com/esxtop/

You can also look at the vSphere documentation ESXTOP Docs.

 

In addition to running esxtop in interactive mode, it can also be run in both batch mode, and replay mode.

Batch Mode

Batch mode can be called by running (r)esxtop -B  -d 5 -n 5 > test.csv.  The -d switch is used for the number of seconds between refreshes, the -n switch is the number of interations.  So in the example I used, the esxtop command would run for about 25 seconds.  (5 seconds delay * 5 iterations)

This is great if you want to see some long term statistics or might want to run the esxtop command during the middle of the night when you’re trying to catch up on some sleep.

Replay Mode

Replay mode can be called by running (r)esxtop -R <supportfilename>.

In this situation you’re using the vm-support command to gather information about your ESX host.  Once the vm-support file is created, you can run the esxtop command up against the vm-support file to see the performance metrics of the host, as if it were running.  This might be very useful if you’re helping someone troubleshoot some performance issues but don’t have access to their system.  They can run the vm-support command to gather the information necessary, and you can then run esxtop against that support file.

I must say that I had several issues with getting this to work in my lab.  I had several issues related to disk space and ended up running the vm-support command so that it would save the output in one of my datastores.  The 5Gbs of local storage I had for the ESXi host wasn’t enough for this support file.  Beware, these support files can be quite large.

Run the vm-support command first:

[sourcecode language=”PowerShell”]vm-support -s -i 10 -d 60 >/vmfs/volumes/[datastore]/supportfile.tgz.[/sourcecode]

Once the vm-support command is done (this may take some time, depending out how long the duration setting is) you need to extract the information from the tgz file to a directory.  Try running:

[sourcecode language=”PowerShell”]tar -zxvf supportfile.tgz[/sourcecode]

from the /vmfs/volumes/[datastore]/ directory.  This will create a new directory with all of the files form the tgz file.  Now finally, we can run the esxtop -r <directory>