Default language.

discovery.vSphereTraverseToObjects


discovery.vSphereTraverseToObjects(target, "start_vsphere_type", start_vsphere_id, "traversal", "end_vsphere_type", ["property", "property", ...])

Queries to traverse from the initial object to instances of an object type and get properties on those objects.You need to know the vsphere_id (MOR ID) from Managed Object Type that you want to start traversing with. It returns the requested properties for each object found. The required parameters are:

  • target - the ESX/ESXi node if discovering using vSphere or via vCenter, or the vCenter node if discovering information about the vCenter server.
  • start_vsphere_type - the starting point, given as a vSphere managed object name specified in the VMware documentation. For example, Folder, Datacenter, ComputeResource, ResourcePool, or HostSystem.
  • start_vsphere_id - MOR (managed object reference) where to start from. The type and id together uniquely identify a managed object in the system we are communicating with.
  • traversal - this is a property name which tells how to get from the start_vsphere_type/start_vsphere_id to end_vsphere_type. It is a simple string.
  • end_vsphere_type - the managed object type at the end of the traversal. Given as a vSphere managed object name specified in the VMware documentation. For example, Folder, Datacenter, ComputeResource, ResourcePool, or HostSystem. All managed objects of different type are dropped.
  • properties - List of properties to retrieve. Each must be simple type (string, int, boolean, and so on), no objects, or lists.

This code example (from the VMware.VirtualCenter pattern module) shows retrieving HostSystem objects from ClusterComputeResource objects. In this example, root_node is the ESXi Host node:

discovery.vSphereTraverseToObjects(root_node, "ClusterComputeResource", cluster_id, "host", "HostSystem", ["name", "hardware.systemInfo.uuid"]);

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*