alarm_handler(3)
πΈ NAME πΈ
alarm_handler β bestie, it's literally an alarm handling process β¨
π DESCRIPTION π
okay so picture this: the alarm handler process is a gen_event event manager process, and its whole thing is receiving alarms in the system. No cap. But here's the tea β it's not trying to be a complete alarm handler, it's just, like, a place where alarms can be sent. A vibe. A destination π
At startup, one simple event handler is installed in the alarm handler. But users are encouraged (read: gently peer pressured, bestie π«Ά) to write and install their own handlers.
So what does that simple event handler do? It sends all alarms as info reports to the error logger, and it saves all of them in a list. That list can be passed to a user-defined event handler that gets installed later. But ngl, that list can grow large if many alarms are generated β which is a very good reason to install a better user-defined handler. It's giving hoarding π
Functions are provided to set and clear alarms, and 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). Iconic, honestly π¦
The alarm handler is part of the SASL application.
When you're 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 it can be exchanged 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 in STDLIB. slay π
π See Also
error_logger, gen_event
β¨ DATA TYPES β¨
alarm() :: {alarm_id(), AlarmDescription :: term()}.alarm_id() :: term().
π₯ FUNCTIONS π₯
clear_alarm(alarm_id()) -> 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. bye bye alarm π
get_alarms() -> [alarm()].
Returns a list of all active alarms. Heads up bestie: this function can only be used when the simple handler is installed. no simple handler, no list, fr fr πΈ
set_alarm(alarm()) -> 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.
and that's the whole page, bestie β go forth and handle those alarms π This lil manual moment was brought to you by Ericsson AB, from the sasl 4.4 era, and yes, it's straight out of the alarm_handler(3) page. periodt πβ¨
π¦ where this page comes from
- nixos 26.05: erlang 29.1.2
- nixpkgs unstable: erlang 29.1.2
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms