I'm seeing an alarm triggered for backup failure, and I think I know why, but I was asked to find out how many times in the past this alarm has gone off recently.
It shows as type 'critical' on the alarms tab of the bottom pane of the web client, but get-vievent doesn't seem to support critical as a type. Would it just be type error or am I looking in the wrong place entirely for this?
These events are returned by Get-VIEvent, but they are of type EventEx.
In there, you have to look for com.vmware.applmgmt.backup.job.finished.event and com.vmware.applmgmt.backup.job.failed.event.
See also Re: Email alerts for vcenter backup via VAMI - VMware Technology Network VMTN
Some sample code
Get-VIEvent -Start (Get-Date).AddHours(-1) -MaxSamples ([int]::MaxValue) |
where{$_ -is [VMware.Vim.EventEx] -and $_.EventTypeId -match 'com.vmware.applmgmt.backup.job'} |
Sort-Object -Property CreatedTime |
Select-Object CreatedTime, @{N = 'vCenter'; E = { ($_.Arguments.Where{ $_.Key -eq '_sourcehost_' }).Value } },Severity,EventTYpeId
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Maybe I have something set wrong, but I can't get anything to return from these commands. I shortened it all the way to just:
get-vievent | where{$_ -is [VMware.Vim.EventEx]}And still it doesn't produce an error or return anything.
If you don't use the MaxSamples parameter the cmdlet will only return 100 events.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Well it is not returning any events currently.
I don't know if another admin is removing them somehow or if we are not setup correctly or if I'm putting in the command wrong.
You will also have to check how long they keep Events in the vCenter.
That is a setting on the vCenter
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That is set to 30 days currently. Had an alarm for backup failure show as created July 31st and now it's just gone though. If that was removed by another admin working on it, it's hard for me to say when the previous backup event would have been (as I am trying to figure that out).
Normally another admin can not remove events from the database.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
