alarm_handler(3erl)
okay bestie, you've landed on alarm_handler(3erl) β the Erlang module definition for An Alarm Handling Process β and it's basically the designated drop-off zone for alarms in the system. β¨
π NAME π
alarm_handler β An Alarm Handling Process
π DESCRIPTION π
So the alarm handler process is a gen_event event manager process that receives alarms in the system. Quick vibe check: this process is not meant to be a complete alarm handler. It literally defines a place where 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. π«Ά
That simple event handler sends all alarms as info reports to the error logger and saves all of them in a list. The list can be passed to a user-defined event handler that can be installed later. Heads up, though: the list can grow large if many alarms are generated β which is a very 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.
π¨ Events you HAVE to handle π¨
When writing new event handlers for the alarm handler, the following events must be handled:
{set_alarm, {AlarmId, AlarmDescr}}β this event is generated byalarm_handler:set_alarm({AlarmId, AlarmDecsr}).{clear_alarm, AlarmId}β this event is generated byalarm_handler:clear_alarm(AlarmId).
The default simple handler is called alarm_handler, and you can exchange it by calling gen_event:swap_handler/3 like this:
gen_event:swap_handler(alarm_handler, {alarm_handler, swap}, {NewHandler, Args})
Then NewHandler:init({Args, {alarm_handler, Alarms}}) is called. For more details, see gen_event(3erl) in STDLIB. π¦
β¨ EXPORTS β¨
π§Ή clear_alarm(AlarmId) -> void()
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()]
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())
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 π¦
before you go, footer tea: Ericsson AB made this page, it's from sasl 4.2, and the footer also carries alarm_handler(3erl). No separate date line is printed there, so that's the whole story. π«Άπ
π¦ where this page comes from
- debian bookworm: erlang-manpages 1:25.2.3+dfsg-1+deb12u1 Β· Apache-2.0
- debian bookworm: erlang-manpages 1:25.2.3+dfsg-1+deb12u4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms