Link to home
Start Free TrialLog in
Avatar of carbonbase
carbonbaseFlag for United Kingdom of Great Britain and Northern Ireland

asked on

how to list past events for a vmware virtual machine

Hi I'd like to see all migration events for a particular virtual machine, as we are trying to troubleshoot performance issues are being caused whenever DRS moves it between hosts.  

I have the following code which pulls off all the events for a specific virtual machine but it only returns the same number of events I can see in the vCenter html5 client, 41 events.

$fileName = $env:Temp + '\report.csv' 
$entity = Get-VM -Name my-vm 
$events = Get-VIEvent -Entity $entity -MaxSamples 1000 | Select CreatedTime,UserName,FullFormattedMessage | Export-Csv -Path $fileName -NoTypeInformation -UseCulture

Open in new window

The vm has been around for a while so I would have thought there were more events than that.  In the vSphere flash based web client you could export all events between specific dates, I know there isn't that feature in the html5 client but is it possible to do this in the vSphere power cli?

ASKER CERTIFIED SOLUTION
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of carbonbase

ASKER

On one vCenter server the only DRS migrations listed are a couple of dozen all between 6pm and 7pm on the 1st May, on my other vCenter server, I can only see one DRS migration on the 28th April.  My clusters aren't super busy so I wouldn't expect to see migrations happening all the time, so I guess that's correct.

My retention is set to 30 days.  I've checked a few different vm's and I've seen a couple with events going back to the 6th April so I guess that's right then.
If you want to view older tasks and events, set to > 30.
Thanks Andrew.  I think for the time being we are ok with only retaining 30 days worth of logging, but it's good to know where that setting is in case we need to change it.