Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

How to gather and export information on VMware ESX Server: Tools and APIs

It's a common misconception that VMware ESX Server offers no information about how it's running on the machine. In this tip, Andrew Kutz explains how to use existing tools to gather information about the ESX system software and the physical server.

The management flexibility and capabilities of VMware have lived up to my needs and expectations in almost all cases. So, I was surprised to hear the following disparaging remarks about VMware's management capabilities recently:

"VMware [ESX Server 2.5.3] is a largely sealed box. While it gives you lots of information about the operating systems and applications running in virtual machines (VMs), it gives you no insight into how VMware itself is running on the machine. So if it's misbehaving, you won't know or be able to fix it. Bigger users are not pleased with this state of affairs. It also means that VMware cannot export any data about itself to other applications. They have no APIs even defined to do that, much less published."

This statement is more untenable than Papa Smurf arguing that the Smurfs do not possess cloning technology. In this article, I will discuss how to gather and export information about the ESX system software and the physical server it is installed on by using existing tools or developing a custom solution with the documented APIs provided by VMware.

Existing tools

Several existing tools can be leveraged to gather and export information about the ESX system software and the underlying physical server hardware.

Vmkusage is a free, Web-based utility developed by VMware. It gathers and displays historical statistics about the physical server, the ESX system software and the VMs. This tool has been installed with all versions of ESX since ESX 2.1, and it is available for download for previous versions as part of the ESX Server Performance Tools. VMware provides documentation on how to use this tool to isolate performance problems in this document.

Vmktree is a free, third-party utility developed by Lars Troen that builds on vmkusage. It is available for download at tihlde.org/~larstr/vmktree/. Building on vmkusage, this utility provides even more ways to view and analyze historical data about the physical server, the ESX system software and the VMs. While vmkusage only generates new graphs every five minutes, vmktree generates graphs in real time. Vmkusage also provides customizable reporting system based on URL parameters and supports exporting data into Microsoft Excel. Another one of vmktree's nice features is its ability to display the output from the next tool.

Esxtop should be familiar to anyone who has ever had to run diagnostics on a Linux or UNIX server. This shell utility is accessible via the ESX console. It provides a real-time view of the ESX system (in this case, "system" means the hardware and the system software), as well as the ESX service console and Vms.

VMware provides documentation on how to use esxtop to troubleshoot performance problems. Given the correct command-line arguments, esxtop can also be run in batch mode so that it samples data at defined intervals and sends its output to a file for further processing and analysis. The script at www.vmguru.com, developed by Michael Knight, is a handy utility to have on hand to parse the output of esxtop. This script parses the batch data generated by esxtop and transforms it into the more manageable CSV format, which can then be imported into Microsoft Excel or almost any other spreadsheet or database application. The script is available for download here.

The MUI, short for Management User Interface, is the out-of-the-box Web interface for managing ESX server. The MUI can be used to determine the CPU load and memory utilization on the ESX system software. In addition, the MUI can be used to determine whether or not physical network interface cards (NICs) are functioning and connected. It can be used to determine the status of the server's connectivity to any type of shared storage device, such as a SAN. More information on the MUI can be found starting at chapter 3 (p. 81) of the VMWare ESX 2.5 Administration Guide.

I left VirtualCenter for last because, while the aforementioned tools have been available for free or packaged with ESX, VirtualCenter is a separate pay-for product. I am including it in this list because it is rare these days to see an enterprise deployment of ESX without VirtualCenter. The VirtualCenter client can export ESX system software historical performance data, such as CPU / memory / disk / network utilization, to a Microsoft Excel file. This may seem like more of the same, but VirtualCenter has different methods of gathering data from other VMware tools, such as vmkusage and the MUI. VMware documents these differences here.

It should be clear now that many tools can be used to gather and export data about the ESX system software and hardware. These utilities can accomplish this task from either a console session or a Web browser. But what if these cookie-cutter programs don't quite fit the bill? No worries; for these situations, we turn to the glorious trinity: coffee beans, developers and APIs.

Documented VMware APIs

VMware offers a collection of documented APIs that can be used to create custom solutions to gather and export information about the ESX system software and the physical server.

VMware Scripting API
The VMware Scripting API exposes Perl and COM scripting interfaces for both ESX and GSX server. With this API, it is possible to access information about the ESX system software, including system uptime and detailed CPU and memory statistics. VMware documents this scripting API extensively here. The relevant sections start at pages 18 and 119.

The VMware CIM SDK is based on the Common Information Model (CIM) standards. The CIM SDK makes it possible to access data about the ESX system software and the physical hardware with the VMWare Schema Extensions. For a more detailed explanation, see the VMware CIM SDK Programming Guide.

VMware Virtual Infrastructure SDK
VMware prefers developers use the VMware Virtual Infrastructure SDK. It can accomplish almost anything that is possible with the VirtualCenter client, including gathering and exporting historical data about the ESX system software. According to VMware, the "SDK enables your program or framework to invoke [the] VirtualCenter Web Server interface functions on VirtualCenter to manage and control ESX Server..." The VMware Virtual Infrastructure SDK Programming Guide is located at www.vmware.com/pdf/SDKProgrammingGuide.pdf and the VMware Virtual Infrastructure SDK Reference Guide is located at www.vmware.com/pdf/SDKReferenceGuide.pdf. To find the relevant material in each document, just search on the keyword performance.

All of the documented VMware APIs I detailed are discussed in greater detail at www.vmware.com/support/developer/. I hope that it is apparent VMware does indeed provide a rich suite of programming interfaces to find out information not only about the VMs but the system software and hardware that runs them as well.


My intent with this article was to demonstrate that ESX is not the sealed box that some people would make it out to be. Tools and APIs exist that can be used to see inside ESX and even manipulate it. If anyone out there is aware of tools or APIs that I have missed, please contact me with them so that I can maintain a running list. I will post this list at my ESX Tips & Tricks section on SearchServerVirtualization.com.

Andrew Kutz has been professionally involved in the technology sector for 11 years. For the last six of them, he has worked with the latest technologies while employed by the University of Texas at Austin. He is an avid fan of VMware, .NET, open source, Terminal Services, coding and comics. He graduated from the University of Texas at Austin, BA in Ancient History and Classical Civilization. He currently lives in Austin, Tex., with his wife Mandy and their two puppies, Lucy and CJ.


Dig Deeper on VMware virtualization

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.