Erlang -- alarm_handler

System Architecture Support Libraries (SASL)

Reference Manual

Version 3.0.4

- User's Guide
- Reference Manual
- Release Notes
- PDF
- Top

- Expand All
- Contract All

### Table of Contents

- sasl (App)
- alarm_handler
  - Top of manual page
  - clear_alarm/1
  - get_alarms/0
  - set_alarm/1
- rb
  - Top of manual page
  - filter/1
  - filter/2
  - grep/1
  - h/0
  - help/0
  - list/0
  - list/1
  - log_list/0
  - log_list/1
  - rescan/0
  - rescan/1
  - show/0
  - show/1
  - start/0
  - start/1
  - start_log/1
  - stop/0
  - stop_log/0
- release_handler
  - Top of manual page
  - check_install_release/1
  - check_install_release/2
  - create_RELEASES/4
  - downgrade_app/2
  - downgrade_app/3
  - downgrade_script/3
  - eval_appup_script/4
  - install_file/2
  - install_release/1
  - install_release/2
  - make_permanent/1
  - reboot_old_release/1
  - remove_release/1
  - set_removed/1
  - set_unpacked/2
  - unpack_release/1
  - upgrade_app/2
  - upgrade_script/2
  - which_releases/0
  - which_releases/1
- systools
  - Top of manual page
  - make_relup/3
  - make_relup/4
  - make_script/1
  - make_script/2
  - make_tar/1
  - make_tar/2
  - script2boot/1
- appup
- rel
- relup
- script

# alarm_handler

### Module

alarm_handler

### Module Summary

An Alarm Handling Process

### Description

The alarm handler process is a gen_event event manager process that 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 startup, 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 in a list. This list can be passed to a user-defined event handler, which can be installed later. The list can grow large if many alarms are generated. This is a good reason to install a better user-defined handler.

Functions are provided to set and clear alarms. The alarm format is defined by the user. For example, an event handler for SNMP can be defined, together with an alarm Management Information Base (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 can 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. For more details, see gen_event(3) in STDLIB.

### Exports

clear_alarm(AlarmId) -> void()

### Types

AlarmId = term()

Sends event clear_alarm to all event handlers.

When receiving this event, the default simple handler clears the latest received alarm 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()

Sends event set_alarm to all event handlers.

When receiving this event, the default simple handler stores the alarm. AlarmId identifies the alarm and is used when the alarm is cleared.

### See Also

error_logger(3), gen_event(3)