You create an alarm with the AlarmManager.CreateAlarm method. In the simplest case, you specify the trigger condition in the AlarmSpec.expression property and the action to perform in the AlarmSpec.action property. When the expression evaluates to true, the alarm performs the action.
CreateAlarm Method Inputs and Outputs shows the CreateAlarm method.
The following steps show how to create an alarm.
Procedure
- Obtain a managed object reference to the AlarmManager associated with the vCenter Server.
- Obtain a managed object reference of the entity on which you want to set the Alarm.
- Create an AlarmSpec data object and specify the alarm details in its properties. See Defining Alarms Using the AlarmSpec Data Object.
- Call AlarmManager.CreateAlarm, passing in the references and the AlarmSpec data object. The system returns a managed object reference to the Alarm (see CreateAlarm Method Inputs and Outputs).
Results
The state of an alarm is contained in an AlarmState data object.