WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud
  • Tanzu
    • Application Modernization
    • Tanzu services
    • Tanzu Community Edition
    • Tanzu Kubernetes Grid
    • vSphere with Tanzu
  • Home Lab
  • Nested Virtualization
  • Apple
You are here: Home / Hidden esxcli APIs

Hidden esxcli APIs

08.28.2010 by William Lam // 3 Comments

A few months back I wrote a three part article about esxcli (part1,part2,part3) and mentioned that no APIs existed. I recently discovered while working on automating ESXi 4.1 installations that this was not the case. I noticed an interesting module called "EsxCLI" that was being loaded while watching the boot logs and that the format of the string match those of the managed object reference names found in vSphere API.

(vim.EsxCLI.corestorage.claiming) ha-cli-handler-corestorage-claiming
(vim.EsxCLI.corestorage.claimrule) ha-cli-handler-corestorage-claimrule
(vim.EsxCLI.corestorage.device) ha-cli-handler-corestorage-device
(vim.EsxCLI.corestorage.plugin) ha-cli-handler-corestorage-plugin

(vim.EsxCLI.network.connection) ha-cli-handler-network-connection
(vim.EsxCLI.network.neighbor) ha-cli-handler-network-neighbor

(vim.EsxCLI.nmp.boot) ha-cli-handler-nmp-boot
(vim.EsxCLI.nmp.device) ha-cli-handler-nmp-device
(vim.EsxCLI.nmp.fixed) ha-cli-handler-nmp-fixed
(vim.EsxCLI.nmp.path) ha-cli-handler-nmp-path
(vim.EsxCLI.nmp.psp) ha-cli-handler-nmp-psp
(vim.EsxCLI.nmp.roundrobin) ha-cli-handler-nmp-roundrobin
(vim.EsxCLI.nmp.satp) ha-cli-handler-nmp-satp

(vim.EsxCLI.swiscsi.nic) ha-cli-handler-swiscsi-nic
(vim.EsxCLI.swiscsi.session) ha-cli-handler-swiscsi-session
(vim.EsxCLI.swiscsi.vmknic) ha-cli-handler-swiscsi-vmknic
(vim.EsxCLI.swiscsi.vmnic) ha-cli-handler-swiscsi-vmnic

(vim.EsxCLI.vaai.device) ha-cli-handler-vaai-device

(vim.EsxCLI.vms.vm) ha-cli-handler-vms-vm

As you can see, all six current namespaces are implemented within the vSphere API with a new managed object called "EsxCLI" just like the esxcli utility:

These APIs of course are hidden and have not been exposed in any of the vSphere SDKs (vSphere SDK for Perl, PowerCLI, VI Java, etc), however, you can access them via the vSphere MOB. As far as I can tell, this is new with vSphere 4.1 and was not available with vSphere 4.0 (unconfirmed).

To access these API methods, you just need to open up a browser and use either an ESX or ESXi host and generate the following url (https://[esx_or_esxi_server]/mob/?moid=ha-cli-handler-vms-vm) and appending one of the above managed object path that begin with ha-

Here is an example of using esxcli's VM namespace:

We can invoke one of the two supported methods for this namespace. We'll query for any available running VMs by just clicking on the method which will open up a new window. You will now click on the "Invoke Method" as it does not require any additional paramters:

You can see this output matches that of esxcli:

I heard that esxcli API would eventually be exposed but may not be available for public consumption, it looks this is not entirely true. VMware, why are you holding out on us? Make your APIs public!

More from my site

  • How to kill a stuck VM on ESX(i) 4.1 using esxcli
  • Applying additional security hardening enhancements in ESXi 8.0
  • ESXi Advanced & Kernel Settings Reference
  • Important - NVMe SSD not found after upgrading to ESXi 7.0
  • SMART drive data now available using vSAN Management 6.6 API

Categories // Uncategorized Tags // esxcli, vSphere 4.1

Comments

  1. Leif says

    03/29/2016 at 1:32 pm

    Do you have a guide on how to use the MOB for updating a firewall ruleset? I can't figure out how to add an IP address to the ruleset.

    Reply
    • William Lam says

      03/30/2016 at 10:48 am

      I don't. You can have a look at the vSphere API http://pubs.vmware.com/vsphere-60/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.host.FirewallSystem.html Curious to why you're using the MOB versus consuming the API through one of our SDKs?

      Reply
  2. Ato says

    06/09/2016 at 8:14 pm

    Is this hidden esxcli APIs available on ESXi 6? I am getting "Service Unavailable" message on my ESXi 6.0 U2 host.
    Is there vSphere API to perform Storage Array Type Policy(SATP) rule removal and reclaim operations?

    Reply

Thanks for the comment! Cancel reply

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

Search

Author

William Lam is a Senior Staff Solution Architect working in the VMware Cloud team within the Cloud Infrastructure Business Group (CIBG) at VMware. He focuses on Cloud Native technologies, Automation, Integration and Operation for the VMware Cloud based Software Defined Datacenters (SDDC)

Connect

  • Email
  • GitHub
  • LinkedIn
  • RSS
  • Twitter
  • Vimeo

Recent

  • vSphere with Tanzu using Intel Arc GPU 01/26/2023
  • Quick Tip - Automating allowed and not allowed Datastores for use with vSphere Cluster Services (vCLS) 01/25/2023
  • ESXi with Intel Arc 750 / 770 GPU 01/24/2023
  • How to bootstrap vSAN Express Storage Architecture (ESA) on unsupported hardware? 01/19/2023
  • Automating Virtual Machine screenshots in vSphere 01/18/2023

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 © 2023