I had a nice little episode with a set of PSOD looping hosts in December which resulted in a lot of guests getting moved around automatically during attempted HA recoveries.
This got me thinking about all the automation that goes on ‘behind the scenes’ as a result of DRS and HA. Also when you have multiple admins, do you know if other admins are moving VM’s around outside of policy or guidelines ?
Of course these things are all measurable and easy to check with PowerCLI, by querying the VIEvent stats.
1. Let’s get a list of guests that have vMotion’d because of DRS in a timeframe (alter the (AddDays(-3) ) to limit the lookback scope)
1 |
Get-VIEvent -maxsamples 10000 -Start (Get-Date).AddDays(-3 ) | Where {$_.FullFormattedMessage -like "DRS migrated*"} |ft createdTime, Net, FullFormattedMessage -autosize |
2. Get a list of guests that have SVMotion’d Get a list of guests that have vMotioned because of DRS (alter the (AddDays(-3) ) to limit the lookback scope
1 |
Get-VIEvent -maxsamples 10000 -Start (Get-Date).AddDays(-3 ) | Where {$_.FullFormattedMessage -like "Migration of virtual machine*"} |ft createdTime, Net, FullFormattedMessage -autosize |
3. What has HA been doing to my guests ?
1 |
Get-VIEvent -maxsamples 10000 -Start (Get-Date).AddDays(-1 ) | Where {$_.FullFormattedMessage -like "vSphere HA restarted virtual machine"} |ft createdTime, FullFormattedMessage -autosize |
Add these to your Powershell cookbooks, you never know when they might come in useful.
As always, test them, and use caution in your environments.