VMware Cloud Community
GurpreetKaurBab
Enthusiast
Enthusiast
Jump to solution

vRO xPath Query

Hi Guys,

I am using below xpath query to find a Virtual Machine using IpAddress, However it takes about 4-7 minutes to find a single VM ( Inventory has 5000 VMs )

Can you guys suggest me a way to fasten the response of the query If possible to a minute or an alternate way.

var ipAddress

var vms = Server.query("VC:VirtualMachine","xpath:ipAddress[contains(.,'" + ipAddress +"')]")

( vRO 7.6 ; vCEnter 6.5 )

Thanks in advance.

Regards

Gurpreet Kaur Babbar

Reply
0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

The property name should be guest.ipAddress

View solution in original post

Reply
0 Kudos
5 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Could you try to find the VM using vCenter's property collector? You can find some sample code in the workflows available in Library > vCenter > Property collector category.

Reply
0 Kudos
GurpreetKaurBab
Enthusiast
Enthusiast
Jump to solution

Hi Ilian,

Thanks for guidance.

I tried using " Get vCenter Entities By Properties"

I filled Inputs as :

vC : choose the vCenter from PlugIn

filter : Entered the "IP ADDRESS" of a VM that resides in that vCEnter

target Type : Virtual Machine

properties : ipAddress

and I get below error :

[2019-10-11 14:07:29.319] [E] Error in (Workflow:Get vCenter entities by properties / pc.retrievePropertiesEx (item1)#46) (vmodl.query.InvalidProperty) {

   faultCause = null,

   faultMessage = null,

   name = ipAddress

Am I inputting wrong values or it is not working for IPAddresses?

Regards

Gurpreet Kaur babbar

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

The property name should be guest.ipAddress

Reply
0 Kudos
GurpreetKaurBab
Enthusiast
Enthusiast
Jump to solution

Thank You.....

It is taking just one second to find the property.

Do you also have any document or list of properties that can be used in this filter, that would be great help.

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

I don't have such a list/document, but I suppose all properties of a given managed object can be used, so you can check the official vSphere Web Services API documentation (for latest 6.7U3 and down to 5.5 version it is available at https://code.vmware.com/apis/704/vsphere​) for a comprehensive list of all managed objects and their properties in a given vCenter version.

Reply
0 Kudos