summaryrefslogtreecommitdiff
path: root/lib/sasl/doc/src/alarm_handler.xml
blob: 68076ba28d2f3e6f57e61c751bde27f65c0e95f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>1996</year>
      <year>2014</year>
      <holder>Ericsson AB, All Rights Reserved</holder>
    </copyright>
    <legalnotice>
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
 
      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

  The Initial Developer of the Original Code is Ericsson AB.
    </legalnotice>

    <title>alarm_handler</title>
    <prepared>Martin Bj&ouml;rklund</prepared>
    <responsible>Bjarne Dacker</responsible>
    <docno></docno>
    <approved>Bjarne D&auml;cker</approved>
    <checked>Martin Bj&ouml;rklund</checked>
    <date>1996-09-10</date>
    <rev>A</rev>
    <file>alarm_handler.sgml.t1</file>
  </header>
  <module>alarm_handler</module>
  <modulesummary>An Alarm Handling Process</modulesummary>
  <description>
    <p>The alarm handler process is a 
      <seealso marker="stdlib:gen_event"><c>gen_event</c></seealso> 
      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.</p>
    <p>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.</p>
    <p>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).</p>
    <p>The alarm handler is part of the <c>SASL</c> application.</p>
    <p>When writing new event handlers for the alarm handler, the
      following events must be handled:</p>
    <taglist>
      <tag><c>{set_alarm, {AlarmId, AlarmDescr}}</c></tag>
      <item>
        <p>This event is generated by
          <c>alarm_handler:set_alarm({AlarmId, AlarmDecsr})</c>.</p>
      </item>
      <tag><c>{clear_alarm, AlarmId}</c></tag>
      <item>
        <p>This event is
          generated by <c>alarm_handler:clear_alarm(AlarmId)</c>.</p>
      </item>
    </taglist>
    <p>The default simple handler is called <c>alarm_handler</c> and
      it can be exchanged by calling 
      <seealso marker="stdlib:gen_event#swap_handler/3"><c>gen_event:swap_handler/3</c></seealso>
      as <c>gen_event:swap_handler(alarm_handler, {alarm_handler, swap},
      {NewHandler, Args})</c>. <c>NewHandler:init({Args, {alarm_handler,
      Alarms}})</c> is called. For more details, see
      <seealso marker="stdlib:gen_event"><c>gen_event(3)</c></seealso>
      in <c>STDLIB</c>.</p>
  </description>

  <funcs>
    <func>
      <name>clear_alarm(AlarmId) -> void()</name>
      <fsummary>Clears the specified alarms.</fsummary>
      <type>
        <v>AlarmId = term()</v>
      </type>
      <desc>
	<p>Sends event <c>clear_alarm</c> to all event handlers.</p>
        <p>When receiving this event, the default simple handler
          clears the latest received alarm with id <c>AlarmId</c>.</p>
      </desc>
    </func>

    <func>
      <name>get_alarms() -> [alarm()]</name>
      <fsummary>Gets all active alarms.</fsummary>
      <desc>
        <p>Returns a list of all active alarms. This function can only
          be used when the simple handler is installed.</p>
      </desc>
    </func>

    <func>
      <name>set_alarm(alarm())</name>
      <fsummary>Sets an alarm with an id.</fsummary>
      <type>
        <v>alarm() = {AlarmId, AlarmDescription}</v>
        <v>AlarmId = term()</v>
        <v>AlarmDescription = term()</v>
      </type>
      <desc>
	<p>Sends event <c>set_alarm</c> to all event handlers.</p>
        <p>When receiving this event, the default simple handler
          stores the alarm. <c>AlarmId</c> identifies the alarm
          and is used when the alarm is cleared.</p>
      </desc>
    </func>
  </funcs>

  <section>
    <title>See Also</title>
    <p><seealso marker="kernel:error_logger"><c>error_logger(3)</c></seealso>,
      <seealso marker="stdlib:gen_event"><c>gen_event(3)</c></seealso></p>
  </section>
</erlref>