VMware Cloud Community
cyan1ni
Contributor
Contributor

Any Rest API to trigger data collection request on specified compute resource from vRA

Hi, all.

I'm working on vRA testing automation through back-end rest API.

Scenario:

As a functional QE, I want a keyword to do data collection on different compute resource in vRA, so that user could use resource of different cluster directly.

I know how to send this request from vRA GUI, but our automation need to go through back-end rest API.

I failed to find any clues from vRA REST API documentations. Does anyone know how to figure it out through any API or SDK?

Thanks.

0 Kudos
18 Replies
GrantOrchardVMw
Commander
Commander

‌Take a look at vRealize Orchestrator and the vRA plugin. It has a Data Collection workflow which would point you in the right direction.

Grant

Grant http://grantorchard.com
0 Kudos
cyan1ni
Contributor
Contributor

It seems this workflow will trigger data collection on the VMs which are under management from a cluster, but for a new added VM which hasn't been registered to vRA, it doesn't work. Do you have any idea about this? Or is there any other workaround?

0 Kudos
AlexJudge
VMware Employee
VMware Employee

Are you referring to Inventory data collection or Performance data collection metrics?

0 Kudos
cyan1ni
Contributor
Contributor

Inventroy data collection and state data collection.

0 Kudos
GrantOrchardVMw
Commander
Commander

Well data collection is performed against a cluster, so I'm perhaps missing what you're trying to achieve here.

Could you break it down a little?

Grant

Grant http://grantorchard.com
0 Kudos
cyan1ni
Contributor
Contributor

Yes. What I'd like to do is:

1. After some changes happened on a cluster which has been managed by vRA (for example, a VM is added to the cluster manually), trigger inventory data collection on this cluster to update the inventory items.

2. After the inventory data collection request complete, check the completion status.

All this operation need to be performed through API or SDK. Do you have any idea about it?

0 Kudos
GrantOrchardVMw
Commander
Commander

Ok, I may still be missing something here. The addition of an unmanaged VM to vCenter has zero impact to vRA. It doesn't change the available resources on the compute resource, it won't affect any reservations, it doesn't become available to any users of vRA. What purpose does the data collection have in this scenario?

Grant

Grant http://grantorchard.com
0 Kudos
cyan1ni
Contributor
Contributor

Yes, it won't be available to any users of vRA. But the vRA database will be refreshed with information of the new added VM and it can be registered to vRA through Bulk Import.

0 Kudos
GrantOrchardVMw
Commander
Commander

Ok, now I get it!

To the best of my knowledge the standard data collection will identify that. The data collection is still not a function that's available via the vRA API, but it can be called from the IaaS API per that orchestrator workflow. I'll test this out tomorrow (bed time here in Oz) and let you know.

Grant

Grant http://grantorchard.com
0 Kudos
cyan1ni
Contributor
Contributor

Thanks a lot, Grant.

BTW could please offer me any reference about IaaS API? I wasn't able to find any document about it through my exploration. Thank you.

Cyan

0 Kudos
FerrerDeCouto
Commander
Commander

Hi Cyan,

Did you get how to trigger the inventory data collection?

Regards,

Jose

José Luis Gómez Ferrer de Couto Founder of PiPo e2H Blog: http://blog.e2h.net Si encuentras que esta o cualquier otra respuesta fue de utilidad, por favor da el voto. Gracias. If you find this or any other answer useful, please consider awarding points. Thank you.
0 Kudos
jason_davis
Enthusiast
Enthusiast

Hi Grant,

I realize this is an old thread, but I'm searching for the same capability.  Specifically, I want to automate this capability in vRA:

Inventory.png

I found this API, but is seems not to be doing the job.

/container-service/api/data-collection

And now it looks like IaaS Proxy Provider Service is deprecated.

We are using vRA version 7.5.

Any suggestions are appreciated.

Thanks,

Jason Davis

0 Kudos
bdamian
Expert
Expert

Hi Cyan1ni,

The easiest way is to use the Orchestrator Workflow called "Force data collection". You can find it in Workflows > Library > vRealize Automation > Infrastructure Administration > Extensibility but this will fire all Datacollections in all clusters.

pastedImage_1.png

If you need to run just an Inventory data collection in a specific Compute Resource, it can be done but is a little tricky because there are some IaaS internal IDs that are difficult to find. I've done it because I manage a platform with several vCenters in more than one location.

Please let me know if this helps you.

D.

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

Damian,

Great job!  Your advice works perfectly!  Only thing I noticed is there is about a 2-3 minute delay between executing the script, and when the updated inventory can be visible inside of vRA.  Not ideal but I can definitely live with it.

Now I just need to automate this via the vRO rest api, and I should be in business.

I want to mark this as the correct answer, but I don't know how.  If you can suggest would be appreciated.

Thanks,

Jason Davis

0 Kudos
bdamian
Expert
Expert

jason_davis,

That delay is because the Workflow is Async. It's not too hard to create a new workflow to execute the "Force data collection" and waits until it finishes. In fact, you should wait for a previous data collection, then run the new Data Collection, and finally wait until it's done.

If you have problems with that, I can create the workflow and post it here.

D.

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

Hi Damian,

I was able to improve the script somewhat.  I made a small modification to ensure that I am only forcing data collection on inventory. 

code.png

This speeds up the process from 2.5 minutes down to about 30 seconds.  It's pretty reasonable for me.

I could not figure out how to go further and make the procedure synchronous.  Would that be a change to the properties (parameters) passed to upDateModelEntity?  Or is there some other API I need to poll to check status on the process?  The documentation is very sparse, so it's a little hard to figure out what each API does.

This is low priority for me, but if you have some idea how to improve further, I am curious to hear your thoughts.

0 Kudos
bdamian
Expert
Expert

What I did was a new workflow called "wait for data collection" that check the status every 5 seconds. Then create a new workflow called "Start Data Collection" with 3 elements:

  • Wait for data collection (because you can start a data collection if there is a data collection running)
  • Force data collection
  • Wait for data collection (waiting for your data collection)

That make sense?

D.

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

Damian,

Based on your feedback, I was able to find the following link which I think covers your idea

Advanced "force data collection" workflow

I am confident to take it from here.  Thanks for the excellent and timely advice!

Jason

0 Kudos