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.

Figure 1. CreateAlarm Method Inputs and Outputs
Shows inputs of Alarm Manager, including Managed Entity and Alarm Spec, to create an Alarm.

The following steps show how to create an alarm.

Procedure

  1. Obtain a managed object reference to the AlarmManager associated with the vCenter Server.
  2. Obtain a managed object reference of the entity on which you want to set the Alarm.
  3. Create an AlarmSpec data object and specify the alarm details in its properties. See Defining Alarms Using the AlarmSpec Data Object.
  4. 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.