Is there a script available to know how many times a virtual machine has migrated off to different hosts in last 24-48hrs?
Have a look at my Events – Part 8 – VMotion History post.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks for the script. However, it is missing to list the "host names" and Time1 and Time2 and Host2 information.
If Host2 and Time2 are empty, you are most probably looking at an svMotion, not a vMotion.
The value in Host1 is directly obtained from the event, if that is missing, there might be an issue with your events.
Can you share what you are seeing?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
In that case, try like this
Get-VIEvent -Start $start -MaxSamples ([int]::MaxValue) |
where{$_ -is [VMware.Vim.VmMigratedEvent] -or $_ -is [VMware.Vim.VmRelocatedEvent]} |
Select CreatedTime,@{N='VM';E={$_.VM.Name}},
@{N='From';E={$_.SourceHost.Name}},
@{N='To';E={$_.Host.Name}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
HI Luc, did you get a chance to look the attached screenshot.... kindly help...
That is a known error. It was fixed in the recent releases of PowerCLI.
Please upgrade your PowerCLI installation
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
ok, to which version needs to be upgraded to fix the problem and get the expe, please advise....
If I remember correctly in 11.3.0.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks, I see some result after upgrading. can this be run for a single server or for couple of servers, instead a whole vCenter ....!
The events are kept on the VCSA, so you will in any case have to connect to the vCenter.
You can of course use a Where-clause to filter the events for a specific ESXi node.
The Entity parameter is another option, but some of these vMotion are triggered by DRS, those will not found in that case.
In conclusion, get them all and use a Where-clause for filtering on one or more ESXi nodes.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'm in need of only couple of VMs vmotion events information from the past one month.
When I run the script for 30 days and for entire vCenter (vCenter has about 1000+ VMs), I guess, it takes days to capture all the events.
could you help please...!
If you know the VMs for which you are looking up the events, you can pass those on the Entity parameter.
That would at least make the query faster.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference