WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple

Retrieving ESXTOP Performance Data Using the vSphere 5.1 API

01.15.2013 by William Lam // 5 Comments

In vSphere 5.1, VMware introduced a new managed object called the Service Manager. The Service Manager is a generic object that wraps the execution of a single command and it requires a specific set of inputs to invoke a particular service command. This is particularly interesting as it allows users to access both the ESXTOP and vscsiStatsinterface using the vSphere API. Prior to vSphere 5.1, to use ESXTOP you would need to either login to the ESXi Shell to run the local ESXTOP command or connect remotely using the RESXTOP utility which is only available on a Linux system. For vScsiStats, you would need to login to the ESXi Shell as a remote version of this tool does not exist. The Service Manager used to be a private interface, an interesting tidbit is that some of you may have already interacted with this interface without even realizing it if you have used PowerCLI's Get-Esxtop cmdlet. In this article I will show you how to programmatically access ESXTOP using the vSphere API.

UPDATE 02/15/2017 - Please see this updated article here for how to access this API using vCenter Server.


Disclaimer: You should try to limit the use of these interfaces for statistics collection or debugging/troubleshooting purposes as there is a certain amount of overhead when running these commands. It is also important to note that since the output is based on the implementer of the service, there is no guarantee that output would not change from one release to the other.

Both the ESXTOP and vscsiStats services are only available when connecting directly to an ESXi 5.1 host, it is not available when connecting to a vCenter Server. If we browse over to the vSphere MOB, we can clearly see the two services:

The first step is to get a reference to the ESXTOP service via the Service Manager and to invoke an operation for ESXTOP, you will need to use the ExecuteSimpleCommand. For ESXTOP, there are three valid operations:

  • CounterInfo
  • FetchStats
  • FreeStats

To demonstrate the ESXTOP interface, I have written a sample vSphere SDK for Perl script called getEsxtop.pl which I will use to explain each operation. Please note the data set that is retrieved is in it's raw data form and requires a bit of data processing.

CounterInfo

This operation only needs to be invoked once and it will provide you with the list of available counters and their associated properties and data types for a given ESXi host. Here is an example of this using the "getcounters" operation implemented in the script:

Each line represents a specific counter type followed by each property name and their data type. For example, the first line is for the Server counter and has the following properties and types:

Property Name Type
MinFetchIntervalInUsec U64
IsVMVisor B
TimeStampInUsec U64
Time S64

Here is a quick diagram to help you visualize the hierarchy of all the ESXTOP counters and their relationships with one another:

Note: This diagram was created using yuml.me and here is the raw text in JSON format if you are interested.

FetchStats

This operation fetches a single snapshot of ALL the ESXTOP statistics which contains two pieces of information:

  • The topology of the counter instances
  • The actual counter instances values

The first section is denoted by ==NUM-OF-OBJECTS== which contains either inventory data that does not change or counter instance structure which describes the relationship between the different counter instances. Here is an example of the first section using the "getstats" operation implemented in the script:

If we take a look at the second line as an example |PCPU|LCPU,24|Core,12|Package,2| we can see that PCPU counter contains 24 LCPU that you would need to then enumerate as well as inventory information describing the CPU's logical cores and physical socket.

To view the enumerated counter instances and their instance values, we need to look in the second portion of the data which is denoted by ==COUNTER-VALUE== within the output. Here is a screenshot of this section and we can see the enumerated LCPU's (24 in total as denoted earlier) and their associated instance values:

Remember you will need to correlate with the counter definitions that was extracted earlier from the "getcounters" and this will help you build up the data. I do have to say it can be a bit confusing when you first look at the raw data, but as you start to play with it a bit more, it will start to make sense. Two useful references that can help with parsing the data is the ESXTOP bible and an article that Luc Dekens wrote awhile back exploring the Get-Esxtop cmdlet which I mentioned earlier leverages this exact interface.

FreeStats

Lastly, once you are done collecting the ESXTOP data, you will need to run the "freestats" operation and this will release any server side resources used during the collection. When this command is invoked, it will free up all resources even for past collections where you might have forgotten to perform this last step. There is no output from this operation as you can see from the example screenshot below:

Even though it is nice to see the ESXTOP interface be accessible via the vSphere API, it is not the easiest interface to use and is definitely geared more towards a developer. For extracting general performance data, I would still recommend using the Performance Manager managed object or one of the above mentioned command-line interfaces. In the next article, I go into more detail about the vscsiStats interface and how to consume it using the vSphere API.

Categories // Automation Tags // api, ESXi 5.1, esxtop, resxtop, service manager, simplecommand, vSphere 5.1, vsphere sdk for perl

New Updates for ghettoVCB & ghettoVCB-restore

01.14.2013 by William Lam // 11 Comments

I know it has taken me awhile, but I finally found some time over the last week and half to go through my entire backlog of bugs, issues, feature requests, etc. and have updated both my ghettoVCB and ghettoVCB-restore script. Here is a quick summary of the new enhancements in this release:

  • ghettoVCB & ghettoVCB-restore supports ESXi 5.1
    • This was a fairly simple change by modifying the version number in the script which I noticed several users sharing the details in the VMTN forums. However, there were a few changes with the release of ESXi 5.1 that caused some initial issues which now have all been resolved in this release. For some of those details, take a look at the "Fixes" section of the change log.
  • Support for individual VM backup via command-line and added new -m flag
    • This has been requested a few times and the idea is if you have a single VM to backup, it was extra work to create a file containing the name of the VM. So now you can specify a single VM backup via the command-line
  • Support VM(s) with existing snapshots and added new configuration variable called ALLOW_VMS_WITH_SNAPSHOTS_TO_BE_BACKEDUP 
    •  This is probably the most requested feature I have seen and as many of you know my personal stance on snapshots, though they can be extremely useful they can also be dangerous when miss-used. I have seen too many VMTN posts about admins finding out they have a 300-500GB snapshot they need to commit and that they are also out of space/etc. However, I decided to support this use case as it was recently brought to my attention that some of the commercial backup solutions that support VMs with existing snapshots just consolidate all snapshots prior to backup. If this feature is enabled, it will consolidate ALL existing snapshots on the VM prior to running a backup.
  • Support multiple running instances of ghettoVCB running and added a new -w flag
    • Today, you can only run a single instance of ghettoVCB, there have been several requests to support running multiple instance and this was a feature submitted which allows you to specify a separate working directory for ghettoVCB. Users should try to minimize the number of instances running as there is a limited amount of resources in the ESXi Shell which can potentially impact your host. Note, this is an experimental feature.
  • Configure VM shutdown/startup order and added two new configuration variables called VM_SHUTDOWN_ORDER and VM_STARTUP_ORDER 
    • This was another submitted feature which allows you to specify the order if which VMs should be shutdown and started back up for which have a dependency between each other. 
  • Support changing custom VM name during restore
    • ghettoVCB-restore has been updated to allow for an optional 4th parameter in the restore file for users to specify an alternate VM name for the restored VM. This can be useful if want to restore the VM alongside the original VM for backup validation purposes (which everyone should do) and by disconnecting the network, you would not be impacting your existing VM while you perform your verification.
  •  Documentation updates

I highly recommend you take a look at the change log for more details (or Github diff more exact changes in the code) as well as the ghettoVCB documentation which has been updated for all the latest changes including feedback from the community. I would also like to thank the ghettoVCB/ghettoVCB-restore community for the feedback and comments you have provided as well as the following users: daviderickson, sethsp, vlooy, gvalkov, jonmchan, fryrpc and aspineux who have all submitted patches for bug fixes and feature requests via the ghettoVCB github repository

I hope you enjoy these two releases and if you run into any troubles, please post in the ghettoVCB VMTN group forum.

Categories // Uncategorized Tags // backup, ESXi 5.1, ghettoVCB, ghettovcb-restore, vSphere 5.1

vCloud Suite Virtual Appliances: Passwords, Databases, URLs, etc

01.07.2013 by William Lam // 11 Comments

I recently re-organized my home lab and I got rid of a bunch of VMs for random projects that I have been working on last year. Part of this re-organization was to re-deploy a few of the virtual appliances found within the vCloud Suite. As part of the deployment, I often find myself scouring various documents looking for default credentials to the OS, VAMI interface or the application. It is not always easy to find and I often end up going to Google or the VMTN forums for the answer.

As a fun little exercise, I thought why not deploy all of the latest virtual appliance that are available in the vCloud Suite and just document the latest usernames/passwords for the application, OS, VAMI interface, database configurations, URLs, etc.? This would primarily be a reference for myself, but thought it might also benefit others as well. Duncan Epping had done this awhile back for vCloud Director and few other virtual appliance and funny enough, his site was one of the first ones I found for the default vCloud Director password.

Not only have I deployed all the virtual appliances from the vCloud Suite, which can be seen from the screenshot below,  but I also went through each appliance and validated the credentials for the application, OS or VAMI interface if applicable as well as identify all database credentials and configurations which are not all publicly documented (this took a bit of digging in the appliances, but was not too difficult if you know where to look).

[Read more...]

Categories // Uncategorized Tags // appliance, database, Oracle, password, postgres, root, username, vami, vcloud suite, vmware, vpostgres, vSphere

  • « Previous Page
  • 1
  • …
  • 464
  • 465
  • 466
  • 467
  • 468
  • …
  • 560
  • Next Page »

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025