Hi Team,
Can we extract lists of warning & Alerts in Vcenter from Power Cli ?
E.g.
thanks
vmk
Some time ago I wrote a script that exports all triggered alarms as a CSV file. It's not nice, but it works.
powercli/export-all-triggered-alarms.ps1 at master · sebkirsch/powercli · GitHub
If you are looking for a history of fired alarms, you can do
where{$_ -is [VMware.Vim.AlarmEvent]} |
Select CreatedTime, @{N='Alarm';E={$_.Alarm.Name}},
@{N='Entity';E={$_.Entity.Name}},
FullFormattedMessage
If you are looking for events of type warning or error, you can do
Select CreatedTime, Severity,EventTypeId,ObjectName,UserName,
FullFormattedMessage
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
It seems we need to increase timeout settings but VC having huge events it appears.
PS C:\script> .\warning.ps1
Get-VIEvent : 01/10/2019 1:06:43 PM Get-VIEvent The request channel timed out while waiting for a reply
after
00:09:59.9746240. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the
Binding. The time allotted to this operation may have been a portion of a longer timeout.
At C:\script\warning.ps1:1 char:1
+ Get-VIEvent -MaxSamples ([int]::MaxValue) -Start (Get-Date).AddDays(- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-VIEvent], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetEvent
Will check and revert back. Thank you.
How many days back did you query?
What is the WebOperationTimeoutSeconds set to in your environment?
You might experiment by setting it to a higher value.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference