With PowerCLI, you can create vCenter Server alarm definitions.
Prerequisites
Verify that you are connected to a vCenter Server system.
Procedure
- Create an alarm action trigger.
$actionTrigger = New-AlarmActionTrigger -StartStatus Green -EndStatus Yellow
- Create an alarm action email.
- Create an event-based alarm trigger.
$vmReconfigEvt = Get-EventType | Where-Object {$_.Description -eq "VM reconfigured"}
$eventTrigger = New-AlarmTrigger -EventType $vmReconfigEvt -EntityStatus Yellow -EntityType "VirtualMachine"
- Create an alarm definition.
$vm = Get-VM | Select-Object -First 1
New-AlarmDefinition -Name "MyAlarm" -Description "Description" -AlarmTrigger $eventTrigger -AlarmAction $emailAction -Entity $vm