Version: $Rev: 265 $
Behaviours: gen_event.
Authors: Serge Aleynikov (serge@hq.idt.net).
lama_guard
process. In case of a handler crash the
process will receive a notification sent by gen_event
exit, and will be restarted by the parent lama_sup_safe
supervisor defined in the lama
module.
alarm() = {AlarmId::alarm_id(), Description::term()}
alarm_id() = atom() | {atom(), Data::term()}
varbinds() = list() | Fun
add_alarm_trap/3 | Add an alarm to trap mapping to the internal #state.alarm_map list. |
clear_alarm/1 | Clear alarm that was previously set by set_alarm/1. |
delete_alarm_trap/1 | Delete an alarm to trap mapping. |
get_alarm_map/0 | Get currently active alarms. |
get_alarms/0 | Get currently active alarms. |
get_def_options/0 | Gets default module's options. |
set_alarm/1 | Set alarm. |
start_link/1 | Installs the new alarm handler. |
stop/0 | Remore alarm handler. |
add_alarm_trap(AlarmID::atom(), Trap::atom(), Varbinds::varbinds()) -> ok
Add an alarm to trap mapping to the internal #state.alarm_map list.
Note: when Alarm key is a tuple of ::alarm_id() type, use the first element
of the tuple as the AlarmID parameter to this function.
Example:
{{AlarmID, _}, _} = {{disk_almost_full, "/usr"}, "Low disk space"}
add_alarm_trap(AlarmID, diskAlmostFullAlarm, []).
clear_alarm(AlarmId::alarm_id()) -> ok | {error, Reason}
Clear alarm that was previously set by set_alarm/1. Error is returned if the alarm is mapped to an SNMP trap, and notification couldn't be sent (in this case the alarm will still be added to the internal alarm list).
See also: check_alarm/2, set_alarm/1.
delete_alarm_trap(AlarmID::atom()) -> ok
Delete an alarm to trap mapping.
get_alarm_map() -> AlarmMap
Get currently active alarms.
get_alarms() -> Alarms
Get currently active alarms.
get_def_options() -> TypedOptions::typed_options()
Gets default module's options.
set_alarm(Alarm::alarm()) -> ok | {error, Reason}
Set alarm. Multiple invocations of this function with the
same AlarmId
will not cause duplicate alarms to
to be set. Error is returned if the alarm is mapped to an SNMP trap,
and notification couldn't be sent (in this case the alarm will still
be added to the internal alarm list).
See also: check_alarm/2, clear_alarm/1.
start_link(Options) -> ok | already_started | throw({error, Reason})
Installs the new alarm handler. It should be called from
the lama_guard's process.
Options:
NotifyName
- Defines the key from the SNMP's
notify.config
configuration file that indicates
the destination SNMP managers that will be receiving
SNMP trapsAlarmTraps
- Defines alarm to trap mappings that
should generate SNMP alarms when corresponding AlarmID's a
set/cleared. os_mon
value adds standard alarms and
traps defined in OTP-OS-MON-MIB.mib. When adding
{AlarmID, Trap, Varbinds::varbinds()} option, Trap must be known to
the SNMP agent by loading some MIB file containing its definition.
Varbinds contains a list of additional values that will be sent
along with the trap, or a function returning such a list.
Refer to SNMP agen't guide for the use of this featurestop() -> ok | {error, Reason}
Remore alarm handler.