Hi,
Few days ago we upgrade two linked vCenters to vCenter 7.0 Upd 3c (from 7.0u2d), all seemed well and of course snapshot has been removed just before we discovered an issue. The issue is that since the update, the Get-VIEvent takes way too long. For example the following command:
Measure-Command{ $VIEvent = Get-VIEvent -maxsamples 100 -Start ($Date).AddDays(-1) }
vCenter A = 50 hosts / 800 VMs and the command takes 21 seconds
vCenter B = 80 hosts / 1400 VMs and the command takes 12 minutes.
Any ideas what could be wrong?
Do you get the same (long) runtime when calling the API directly?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Don't know how 🙂
You could try the Get-VIEventPlus function from my Get the vMotion/svMotion history post.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ran it like this:
Measure-Command{ $VIEvent = Get-VIEventPlus -Start ($Date).AddDays(-1) }
Finished in about 5min
But it did give me some errors:
Get-View : 17-3-2022 17:46:48Get-ViewThe underlying connection was closed: A connection that was expected to be kept alive was closed by the server.
At line:52 char:13
+ $eventMgr = Get-View EventManager
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-View], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView
Get-View : 17-3-2022 17:46:48 Get-View View with Id 'EventManager-EventManager' was not found on the server(s).
At line:52 char:13
+ $eventMgr = Get-View EventManager
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [Get-View], VimException
+ FullyQualifiedErrorId : Core_GetView_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView
You cannot call a method on a null-valued expression.
At line:89 char:1
+ $eventCollector = Get-View ($eventMgr.CreateCollectorForEvents($event ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:90 char:1
+ $eventsBuffer = $eventCollector.ReadNextEvents($eventnumber)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:95 char:1
+ $eventCollector.DestroyCollector()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
I suspect you hit the 300 seconds default timeout for web operations.
You can increase that via the Set-PowerCLIConfiguration cmdlet with the WebOperationTimeoutSeconds parameter.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Already discovered some other issues in this vCenter as well, not just powercli. Created a ticket with VMware Support.
Thanks for the help!
So in conclusion, it doesn't appear to be the Get-VIEvent cmdlet 😁
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
hehe indeed