Introduction to the PropertyCollector
The PropertyCollector service interface provides a way to monitor and retrieve information about managed objects, such as whether a virtual machine is powered on or whether a host in a cluster is offline.
The PropertyCollector uses one or more filters to determine the scope of collection and it has methods to retrieve data. A filter uses a set of data objects that specify the following information:
A vSphere server creates a default PropertyCollector for every session, and allows you to create multiple, additional PropertyCollector objects. Create additional PropertyCollector objects, using one per thread, to perform mutually independent collection operations.
Data Retrieval
There are two ways to retrieve data:
Property retrieval as a single operation uses the RetrievePropertiesEx and ContinueRetrievePropertiesEx methods. These methods perform a single collection operation.
Incremental property retrieval, also referred to as property monitoring, uses the WaitForUpdatesEx method. The initial call to this method retrieves a baseline set of managed object property values. Subsequent calls retrieve changes in property values since the last retrieval. Use WaitForUpdatesEx to monitor changes to the inventory or any managed object properties.
Note The PropertyCollector does not guarantee the order of data that it returns in response to a request for data.
Inventory Traversal and Object Selection
PropertyCollector filter properties identify object properties and paths that define inventory traversal. For example, you can retrieve the properties for a VirtualMachine object and specify a traversal path using the VirtualMachine.network property to obtain the properties for the associated Network objects.
You can use vSphere view objects (for example, ContainerView) in filters to simplify traversal specification. A view maintains a subset of inventory objects, so if there is a change in the inventory hierarchy, you do not have to recreate the view. Use a view to specify a set of objects that the PropertyCollector can use for data collection.
For information about the vSphere inventory, see Datacenter Inventory.