VMware Cloud Community
orian
Hot Shot
Hot Shot

date of poweroff vm

Hi,

Is there in the orchestrator an attribute which save when the server has been shutdown?

Thanks!

1 Reply
iiliev
VMware Employee
VMware Employee

You can retrieve this information from vCenter Event Manager.

Here is sample code that enumerates all poweroff events of a given virtual machine ('vm' is the input parameter of type VC:VirtualMachine):

var spec = new VcEventFilterSpec(); 

spec.eventTypeId = ["VmPoweredOffEvent"];

spec.entity = new VcEventFilterSpecByEntity(); 

spec.entity.entity = vm; 

spec.entity.recursion = VcEventFilterSpecRecursionOption.self; 

var events = vm.sdkConnection.eventManager.queryEvents(spec); 

for each (var ev in events) { 

  System.log("Powered off on: " + ev.createdTime + " by: " + ev.userName);

}