Back in 2013, I wrote two articles here and here on how to use the Service Manager API that was introduced in vSphere 5.1 to remotely collect ESXTOP and vscsiStats metrics. At the time, I was told that this API was only available when connecting directly to an ESXi host using the vSphere API. This was still a huge improvement over the previous method which basically required customers to run the commands locally. For ESXTOP, there was resxtop but it was not available for all platforms and some customers still prefer to use the ESXi Shell's version. When I had learned about this API, I was really hoping I could collect both ESXTOP & vscsiStats metrics using vCenter Server which would remove the need to have direct connectivity to each ESXi host.

Last week, an Engineer came across one of my blog posts related to the Service Manager APIs which helped him with a problem he was trying to solve. In the email conversation, I then came to learn from the Engineer that the the Service Manager API can be used from vCenter Server and going directly to the ESXi host was not necessary. It turns out that the QueryServiceList() method which accepts an array of "location" expects a special keyword prefix appended to the list of ESXi hosts that you wish to use the local Service Manager instances on.

The special keyword prefix is "" and this is appended to either the Hostname or IP Address of the ESXi hosts being managed by the vCenter Server. For example, in my environment I have an ESXi host ( that is managed by my VC and so the location string for that host should be "". If the method was successfully called, you should get back the two service instances for ESXTOP and vscsiStats for each of the ESXi hosts where you can then perform the metric collection.

I have created two sample pyvmomi scripts which exercises the Service Manager API for ESXTOP and vscsiStats:

Note: For more details on how to use Service Manager API to collect ESXTOP and vscsiStats, please refer to this post here and here.

Here is an example of running the ESXTOP sample script and executing the "CounterInfo" operation:

Here is an example of running the vScsiStats sample script and executing the "FetchAllHistograms" operation:

I had initially tried to create the two sample scripts using PowerCLI, but it looks like there may be a bug with PowerCLI when calling the Service Manager instance.

If you try to run the following snippet which retrieves the view for the Service Manager

Get-View $global:DefaultVIServer.ExtensionData.Content.ServiceManager

You will find that it throws the following error. I have already filed an internal bug and hopefully this get resolved in a future PowerCLI update so that customers who wish to retrieve ESXTOP and vScsiStats can do so using PowerCLI. For all other vSphere SDKs, it should work as expected.

UPDATE (02/25/17) - After talking to PowerCLI Dev team, I was able to get the necessary information to come up with a workaround to access both ESXTOP and vScsiStats information using PowerCLI when connected to a vCenter Server. Below are the two examples which exercises the two service APIs:

Here is an example of running the Get-EsxtopAPI.ps1 script:

Here is an example of running the Get-VscsiStats.ps1 script:

Thanks for the comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.