Once HA Event happens on 5.x series, How quick can I get the entire affected List of Virtual machines OR rebooted ?
Any script or CMD from VCLI to find the Event on Cluster. Let me know the CMD Details.
Hello,
to get that list of virtual machines, you can use some excellent stuff from LucD (with at least powershell 2.0 and vmware powercli):
First, you need the Get-VIEventPlus function developed by LucD:
http://www.lucd.info/2013/03/31/get-the-vmotionsvmotion-history/
Then, use this script taken from here:
$entity = Get-Folder Datacenters
$start = (Get-Date).AddMonths(-3)
$Recurse = $false
$eventTypes = "com.vmware.vc.ha.VmRestartedByHAEvent"
Get-VIEventPlus -Entity $entity -Start $start -EventType $eventTypes |
Select CreatedTime,@{N="VM";E={$_.Vm.Name}},@{N="ESX";E={$_.Host.Name}}
Best regards,
Pablo
Hello again,
this script (taken from here😞
$Date = Get-Date
$HAVMrestartold =5
Get-VIEvent -maxsamples 100000 -Start ($Date).AddDays(-$HAVMrestartold) -type warning | Where {$_.FullFormattedMessage -match "restarted"} |select CreatedTime,FullFormattedMessage |sort CreatedTime -Descending
list the virtual machines restarted by HA in the last 5 days ($HAVMrestartold).
Maybe this is more easy to use than the LucD's script
Obviously, you need powercli and powershell to run this script (and don't remember to use the Connect-VIServer cmdlet before, to be able to connect to the vCenter server)
Best regards,
Pablo