UIM Can the vmware probe resource relationship tree be queried?

Document ID : KB000107036
Last Modified Date : 06/08/2018
Show Technical Document Details
We want to be able to make use of the hierarchy the vmware probe gets to track which hosts and datastores certain VMs are on. How do we do that?
The relationship tree can be queried using the nisapi :
http://(UIM Server Host)/nisapi/relationship/tree?id=(vcenter cs_id).
http://(UIM Server Host)/nisapi/element/ipelement?id=all 
http://(UIM Server Host)/nisapi/element/ipelement?id=all&role=vCenter 

Spectrum also uses this api and then parses the result to form the hierarchy. Each component knows its immediate parent and children. So, if we want to find the cluster in which a VM is located, then using the relationships first we can find the ESX host where the VM is and then find the clsuter where the ESX is located.

This relationship is stored in UIM database tables.
For example:
select * from CM_RELATIONSHIP_CS_CS where target_id = 44
//The source_id of the result  will give the cs_id of ESX Host, if target_id is cs_id of a VM

select * from CM_RELATIONSHIP_CI_CS where target_id = 44
// This will give any logical component like resource pool to which this VM belongs.

Additional Information:
All of the relationship tree info is contained in these four tables: