User's Guide
Reference Manual
Release Notes
PDF
Top

System Application Support Libraries (SASL)
Reference Manual
Version 2.1.10

Expand All
Contract All

Table of Contents

# alarm_handler

### MODULE

alarm_handler

### MODULE SUMMARY

An Alarm Handling Process

### DESCRIPTION

The alarm handler process is a gen_event event manager process which receives alarms in the system. This process is not intended to be a complete alarm handler. It defines a place to which alarms can be sent. One simple event handler is installed in the alarm handler at start-up, but users are encouraged to write and install their own handlers.

The simple event handler sends all alarms as info reports to the error logger, and saves all of them in a list which can be passed to a user defined event handler, which may be installed at a later stage. The list can grow large if many alarms are generated. So it is a good reason to install a better user defined handler.

There are functions to set and clear alarms. The format of alarms are defined by the user. For example, an event handler for SNMP could be defined, together with an alarm MIB.

The alarm handler is part of the SASL application.

When writing new event handlers for the alarm handler, the following events must be handled:

{set_alarm, {AlarmId, AlarmDescr}}

  This event is generated by alarm_handler:set_alarm({AlarmId, AlarmDecsr}).

{clear_alarm, AlarmId}

  This event is generated by alarm_handler:clear_alarm(AlarmId).

The default simple handler is called alarm_handler and it may be exchanged by calling gen_event:swap_handler/3 as gen_event:swap_handler(alarm_handler, {alarm_handler, swap}, {NewHandler, Args}). NewHandler:init({Args, {alarm_handler, Alarms}}) is called. Refer to gen_event(3) for further details.

### EXPORTS

clear_alarm(AlarmId) -> void()

Types:

AlarmId = term()

Clears all alarms with id AlarmId.

get_alarms() -> [alarm()]

Returns a list of all active alarms. This function can only be used when the simple handler is installed.

set_alarm(alarm())

Types:

alarm() = {AlarmId, AlarmDescription}
AlarmId = term()
AlarmDescription = term()

Sets an alarm with id AlarmId. This id is used at a later stage when the alarm is cleared.

### See Also

error_logger(3), gen_event(3)