Hello,
Today, i wanted to share with you a vRO workflow helping me to get the list of restarted virtual machine by HA on a vCenter. This Workflow can be called by any monitoring tool when an snmp trap is sent by vCenter :
Inputs & Outputs

Workflow Schema

Source Code for Used on Scriptable Task
//init variables //iterator var i=0; //the list of restarted Virtual machines var VMList = []; //The Time when VM HA Happened var Time = []; //Get All vCenter VMs var allvms = vCenter_Name.allVirtualMachines; //filter Events for each (var vm in allvms){ var beginTime = new Date(); //Set Start Date here we chose to parse the last 24hours events beginTime.setHours(beginTime.getHours()-24); //Create Event var vcEventFilterSpec = new VcEventFilterSpec(); var spec = new VcEventFilterSpec(); var vcEventFilterSpecByTime = new VcEventFilterSpecByTime(); vcEventFilterSpec.time = vcEventFilterSpecByTime; vcEventFilterSpecByTime.beginTime = beginTime; //the Type ID of HA Event spec.eventTypeId = ["com.vmware.vc.ha.VmRestartedByHAEvent"]; spec.entity = new VcEventFilterSpecByEntity(); spec.entity.entity = vm; spec.entity.recursion = VcEventFilterSpecRecursionOption.self; spec.time = vcEventFilterSpecByTime; var events = vm.sdkConnection.eventManager.queryEvents(spec); //For each VM we query VM restart Event on the 24 hours last hours for each (var ev in events) { System.log(ev); VMList[i]= String(ev.fullFormattedMessage).split(' ')[5]; Time[i]= String (ev.createdTime); i=i+1; } }