Advanced "force data collection" workflow

Advanced "force data collection" workflow

Hi guys,

when working with IaaS entities in vCO / vCAC data-collection can be a pain in the a**. By default the vCAC plugin comes with a "force data collection" workflow that will start a data-collection of all data-sources of the given vCAC IaaS host. However: the workflow is implemented as an fire-and-forget task. It triggers the data-collection and finishes, giving the user no information about the collection status.

When building workflows that work with vCAC endpoints (e.g. vSphere) and vCAC-CAFE, this makes it hard to know when or if a endpoint ressource will be available in the vCAC IaaS entity model. Trying to solve this problem by adding long "sleep" tasks often fails because the time needed for data-collection varies alot.

So today I decided to put an end to failed workflows due to not-yet available entities in the IaaS model and created a "Advanced force data collection" workflow. It will start a data-collection and start polling in order to check the collection status. Once all triggered data-sources have been updated, it'll finish. Optionally you can set a flag so the workflow fails if a data-source could not be updated.

It'll probably be of no use to most of you guys, but if you ever have to work with IaaS entities, you'll love it. Enjoy!

About

  • This workflow will start vRealize Automation data-collection for the selected sources from vRO and return execution context  after the data-collection finished

Changelog

  • Changed licensing to LGPLv3, should make everyones life easier now.
  • Now allows you to select the source(s) for data-collection
  • Now handles orphaned and non-configured data-sources

Requirements

  • vRealize Orchestrator 6.x


Licensing

Copyright (C) 2014-2015  Robert Szymczak

This program is free software: you can redistribute it and/or modify

it under the terms of the GNU Lesser General Public License as published

by the Free Software Foundation, either version 3 of the License, or

(at your option) any later version.

This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License

along with this program. If not, see <http://www.gnu.org/licenses/>.

Attachments
Comments

Very cool!  I anticipate using this soon and didn't look forward to writing it Smiley Happy.

Please note this code is not quite working as expected.  The Workflow timeout does not timeout for the overall workflow.  Instead the timeout works against each host.  Thus if the timeout is set to 1 hour and there are 90 hosts, and data cannot be collected on any of them (extreme case), the workflow will literally run for 90 hours which is the cumulative time it takes for all of the hosts to individually timeout.

Well, yes. You have to adopt the workflow to your needs. Don't just download and use it without looking into the source (you should never do that anyway). The hard part was to find ANY way to know when the datacollection had run successfully from the legacy database. Back when I created this thing there was no other option then 'hacking' your way through the database model. It's not the best way to do it but at that time I was left with no other options. That's what this workflow will give you.

The rest totally depends on your usecase.

That said: by now quite few things changed in vRA (datacollection times have been reduced significantly, for example). And sometime in the future the iaas database will hopefully be gone for good and there will be no need to datacollect the way it's done now. I have not updated this workflow ever since because I had no use for it any longer. As I said in the beginning: don't just download and use this if you don't understand what it's doing.

Hello,
​​
​Your workflow works fine and i wanted to only update an ESXI host system when i provision a VM to avoid long time update.

So , i tryed to identify the ESXi who run the VM, and then look for the VCAC HOST MACHINE that match the name of the HOST.

Here is the code :


​hostname="l203rkj004"
vm = Server.findAllForType("Vc:virtualMachine","xpath:name='"+hostname+"'")[0]
var hostSystem = vm.runtime.host;
var vcachostmachine = []
System.log(hostSystem.name)

vcachostmachines = Server.findAllForType("vCAC:Hostmachine")
for each (item in vcachostmachines)
{
//System.log(item.hostName)
    if (item.hostName==hostSystem.name){
    vcachostmachine.push(item)
    System.log (vcachostmachine)
    break
    }
}


System.log(vcachostmachine)

Logging the vcacahostmachine seems good, but when sent to the WF, several host are found, but when seaching data collection entitites, nothing is found and the WF ends...

[2018-09-17 10:56:44.661] [I] DynamicWrapper (Instance) : [vCACHostMachine]-[class com.vmware.o11n.plugin.dynamicops.model.HostMachine] -- VALUE : v203pvw292

[2018-09-17 10:56:44.662] [I] DynamicWrapper (Instance) : [vCACHostMachine]-[class com.vmware.o11n.plugin.dynamicops.model.HostMachine] -- VALUE : v203pvw292

[2018-09-17 10:56:44.703] [I] DynamicWrapper (Instance) : [vCACHostMachine]-[class com.vmware.o11n.plugin.dynamicops.model.HostMachine] -- VALUE : v203pvw292

[2018-09-17 10:56:44.804] [I] Searching data collection entities...

Do you have an idea ?

thanks

Version history
Revision #:
1 of 1
Last update:
‎10-03-2014 07:01 AM
Updated by: