vCenter server offer the possibility to configure custom alarms based on certain vCenter events, as for example described in Configure a custom vCenter alarm for APD or PDL events.
To configure such an alarm, you can use the internal ID of the specific event, in order to trigger the alarm when such an event occurs.
This article describes how to find out these internal event IDs.
VMware vCenter Server 7.0.x
VMware vCenter Server 8.0.x
To get a list of the event IDs available in vCenter, with their full text description, you can use a PowerCLI script similar to the following example:
$evt = Get-View EventManager
$eventInfo = $evt.Description.EventInfo | Select-Object -ExpandProperty FullFormat | Sort-Object
$results = foreach ($line in $eventInfo) {
if ($line -like "*|*") {
$segments = $line.Split("|")
[PSCustomObject]@{
"Event String" = $segments[0].Trim()
"Full Text" = $segments[1].Trim()
}
}
}
$results | Format-Table
You can also list the event IDs used in the existing alarms, for example using a script like this:
$alarmMgr = Get-View AlarmManager
$allAlarms = Get-View -Id $alarmMgr.GetAlarm($null)
$results = foreach ($alarm in $allAlarms) {
foreach ($expression in $alarm.Info.Expression.Expression) {
if ($expression -is [VMware.Vim.EventAlarmExpression]) {
[PSCustomObject]@{
AlarmName = $alarm.Info.Name
EventTypeID = $expression.EventTypeId
Description = $alarm.Info.Description
}
}
}
}
$results | Format-Table
However, please be aware that certain alarms, like any related to ESXi hardware status changes, will not solely use an unique event ID as trigger, but rather work with a combination of the specific event and other readings, usually some sensor output.
Note: The above scripts are examples, those are not production-ready scripts. You can use them as the basis for your own scripts, but you should run thorough tests in a non-production environment to confirm the functionality.