Wednesday, August 27, 2008

Watching your ESX server performance in real time with ESXTOP

Very few people understand the power of the VMware Console. Even fewer know the power of esxtop, a command-line real-time monitor for the vmkernel. You can get more information here.

One of the most awesome things about esxtop is that it’s minimally intensive on resources and can be run interactively, as a batch mode or as replay worlds.

However the practice of logging in and running it with root logged in on every ESX host is a little annoying and exposes anyone with basic knowledge to the Ctrl-C kill command, and then the root prompt. Which is bad.

What I do on some of my sites is similar to what VMware does on tty11 (Ctrl+Alt+F11) - the VMware ESX Service Console Welcome Screen. Essentially, I output a dynamic interactive esxtop to one of the available tty’s (tty7-12 are disabled in ESX 3.x, so you have to use 1-5, 6 is the emergency console)

Here’s what you need to do edit in the/etc/inittab file:

Edit out the mingetty tty5 terminal by making this line:

5:2345:respawn:/sbin/mingetty tty5

…look like this:

#5:2345:respawn:/sbin/mingetty tty5

Then, insert the following bolded lines after the non-bolded line which should already exist in your /etc/inittab:

6:2345:respawn:/sbin/mingetty -f /etc/issue.emergency -l /bin/login.emergency tty6

# Output ESXTOP to Console/tty5
esxtop:2345:respawn:/usr/bin/esxtop -d 2 -s > /dev/tty5 < /dev/tty5

After this, reboot your ESX server and watch console 5 (Ctrl+Alt+F5) - you will see all your vmkernel performance stats, and you can control them interactively as per the instructions for esxtop which you can find by running man esxtop in the service console. Or you can read the documentation here.


No comments: