VMware Cloud Community
darrenoid
Enthusiast
Enthusiast
Jump to solution

Way to list number of VMs deployed from a specific template image?

I am trying to find out how often certain VM Templates are used for provisioning in vRA. I believe the VM template name is stored in the clonefrom property during deployment. I am having trouble figuring out how and what to query for this history. I have tried cloudclient vra request details, but am unsure where in that data the template name is stored, if it is there at all. I have also tried the vra API catalog-service/api/consumer/requests, but can't seem to find it in the requestData field. To complicate issues more, we are using image profiles, so I can't just filter off of the blueprint name deployed as the same blueprint may be used for multiple image templates.

Would appreciate any help or pointers for gathering this type of historical data from vRA.


Thanks,
Darren

Reply
0 Kudos
1 Solution

Accepted Solutions
bdamian
Expert
Expert
Jump to solution

I have a weird work around.

You can use the IaaS API but, you will get information about existing VMs (not deleted vms). And, you cannot filter the query using a custom property value.

So, if you can narrow the search using dates (maybe VMs created last week) this could help you:

Method: GET (with NTLM authentication)

Headers: Accept: application/json

URL:

https://{IaaS host}/repository/Data/ManagementModelEntities.svc/VirtualMachines()/?$filter=(IsDeleted%20eq%20false)%20and%20(IsManaged%20eq%20true)&$expand=VirtualMachineProperties

IsManaged eq true -> means only managed by vRA (you can imagine other filters using the attributes of the response)

expand=VirtualMachineProperties -> retrieve custom properties

You can browse the response, every VM will have all Custom Properties and you can find one with name "__clonefrom". The value will be the name of the template.

Hope this helps.

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian

View solution in original post

Reply
0 Kudos
3 Replies
daphnissov
Immortal
Immortal
Jump to solution

I'm pretty sure that you can gather this from vrealize operations using the VRA management pack.

Reply
0 Kudos
bdamian
Expert
Expert
Jump to solution

I have a weird work around.

You can use the IaaS API but, you will get information about existing VMs (not deleted vms). And, you cannot filter the query using a custom property value.

So, if you can narrow the search using dates (maybe VMs created last week) this could help you:

Method: GET (with NTLM authentication)

Headers: Accept: application/json

URL:

https://{IaaS host}/repository/Data/ManagementModelEntities.svc/VirtualMachines()/?$filter=(IsDeleted%20eq%20false)%20and%20(IsManaged%20eq%20true)&$expand=VirtualMachineProperties

IsManaged eq true -> means only managed by vRA (you can imagine other filters using the attributes of the response)

expand=VirtualMachineProperties -> retrieve custom properties

You can browse the response, every VM will have all Custom Properties and you can find one with name "__clonefrom". The value will be the name of the template.

Hope this helps.

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
Reply
0 Kudos
darrenoid
Enthusiast
Enthusiast
Jump to solution

Thanks for the tips. We may try out vRealize Operations soon, but for now the IaaS API seems promising for this. I found an example vRO action that I am playing with now to see if it will work:

Find all VMs with a particular property value in vRA · GitHub

It would be nice to also get data on past deleted VMs.

Reply
0 Kudos