Create Alarm Definitions on vCenter Server

With PowerCLI, you can create vCenter Server alarm definitions.

Prerequisites

Verify that you are connected to a vCenter Server system.

Procedure

  1. Create an alarm action trigger.
    $actionTrigger = New-AlarmActionTrigger -StartStatus Green -EndStatus Yellow
  2. Create an alarm action email.
    $emailAction = New-AlarmAction -Email -To '[email protected]' -CC @('[email protected]', '[email protected]') -Body 'Email text' -Subject 'Email subject' -AlarmActionTrigger $actionTrigger
  3. Create an event-based alarm trigger.
    $vmReconfigEvt = Get-EventType | Where-Object {$_.Description -eq "VM reconfigured"}
    $eventTrigger = New-AlarmTrigger -EventType $vmReconfigEvt -EntityStatus Yellow -EntityType "VirtualMachine"
    
  4. Create an alarm definition.
    $vm = Get-VM | Select-Object -First 1 
    New-AlarmDefinition -Name "MyAlarm" -Description "Description" -AlarmTrigger $eventTrigger -AlarmAction $emailAction -Entity $vm