Using Alarms
The vSphere alarm infrastructure supports automating actions and sending different types of notification in response to certain server conditions. Many Alarms exist by default on vCenter Server systems. You can also create alarms yourself. For example, an Alarm can send an alert email message when CPU usage on a specific virtual machine exceeds 99% for more than 30 minutes.
The alarm infrastructure integrates with other server components, such as events and performance counters.
The AlarmManager is the service interface for creating, setting, and managing alarms. You create an alarm, specifying trigger conditions and the action to take. When the conditions defined for the Alarm occur on the system, the Action specified for the alarm starts. The alarm also generates an Event that is posted to the Event history database. In addition, the action initiated by the Alarm might also post a second Event to the database, depending on the Action type.
Obtaining a List of Alarms
Use the AlarmManager. GetAlarm method to obtain an array of references to all Alarm managed objects defined for a specific managed entity. When you call the method, you can pass in an optional reference to a managed entity. Without a reference to a managed entity, the GetAlarm operation returns all Alarm objects for all entities that are visible to the principal associated with the session invoking the operation.
Alarm Managed Object
The Alarm.info property is an AlarmInfo data object. You can obtain information about active Alarms by collecting the properties of the AlarmInfo data object.
Creating an Alarm
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.
CreateAlarm Method Inputs and Outputs
To create an alarm
1
Obtain a managed object reference to the AlarmManager associated with the vCenter Server.
2
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).
The state of an alarm is contained in an AlarmState data object.