A Little Known Secret of vSphere Managed Object Browser
Most VI SDK developers know Managed Object Browser (MOB), and mostly have used it for better understanding of the SDK, or assisting programming and debugging. In my opinion, it’s a must-have tool for every vSphere SDK developer.
It’s extremely helpful if you want to figure out the inventory path of certain managed entities. The vSphere Client shows you different paths which don’t work with the SearchIndex and others. Nothing wrong with vSphere Client – it just tries to display information in a way that is easier to understand by the system administrators.
To use the browser, you just enter the following URL to your server:
https://<ip_address|host_name>/mob/
After entering the user name and password, you see the home of the MOB. You can then click down to different managed objects, and even invoke methods. Check this document in vSphere Client Plug-ins community, in which I described how to use MOB to register a plug-in with “100% less line of code” (Carter’s joke, by the way). Because you have to change XML content, it could be quite error prone. Therefore you wouldn’t want to use it as a norm.
Everything till here is common knowledge. If you have ever closely read the HTML source of the MOB pages, you can find a section as follows:
<xml id="objData">
<object>
<capability xsi:type="Capability">
<provisioningSupported>false</provisioningSupported>
<multiHostSupported>false</multiHostSupported>
<userShellAccessSupported>true</userShellAccessSupported>
</capability>
<content xsi:type="ServiceContent">
<rootFolder type="Folder">ha-folder-root</rootFolder>
<propertyCollector type="PropertyCollector">ha-property-collector</propertyCollector>
<viewManager type="ViewManager">ViewManager</viewManager>
<about>
<name>VMware ESX Server</name>
<fullName>VMware ESX Server 3.5.0 build-62355</fullName>
<vendor>VMware, Inc.</vendor>
<version>3.5.0</version>
<build>62355</build>
<localeVersion>INTL</localeVersion>
<localeBuild>000</localeBuild>
<osType>vmnix-x86</osType>
<productLineId>esx</productLineId>
<apiType>HostAgent</apiType>
<apiVersion>2.0.0</apiVersion>
</about>
<setting type="OptionManager">HostAgentSettings</setting>
<userDirectory type="UserDirectory">ha-user-directory</userDirectory>
<sessionManager type="SessionManager">ha-sessionmgr</sessionManager>
<authorizationManager type="AuthorizationManager">ha-authmgr</authorizationManager>
<perfManager type="PerformanceManager">ha-perfmgr</perfManager>
<eventManager type="EventManager">ha-eventmgr</eventManager>
<taskManager type="TaskManager">ha-taskmgr</taskManager>
<accountManager type="HostLocalAccountManager">ha-localacctmgr</accountManager>
<diagnosticManager type="DiagnosticManager">ha-diagnosticmgr</diagnosticManager>
<licenseManager type="LicenseManager">ha-license-manager</licenseManager>
<searchIndex type="SearchIndex">ha-searchindex</searchIndex>
<fileManager type="FileManager">ha-nfc-file-manager</fileManager>
<virtualDiskManager type="VirtualDiskManager">ha-vdiskmanager</virtualDiskManager>
</content>
<serverClock xsi:type="xsd:dateTime">2010-02-02T18:20:47.427266Z</serverClock>
</object></xml>
If you are familiar with vSphere SDK, you know this XML holds all the property values of the ServiceInstance managed object. It’s not only for this starting managed object, but for every managed object along your clicking!
Remember, when your browser can get the information, you can write programs to do it as well. This actually led me to write the Client REST API, which released in VI Java 2.0. This is a very tiny yet powerful set of APIs which allow you to do everything, at least in theory, VI SDK can do for you.
It’s interesting to note that, when I talked to our engineer who wrote this great tool, he mentioned to me there was a secret in the MOB pages. By that time, I already shipped the API. There is little secret in IT today
.
I will blog on the Client REST API later. Stay tuned by subscribe the feed.
The MOB can also access internal-only objects such as VimCLIInfo, check out this screenshot for some clues http://twitpic.com/v11ks