File: alarm_handler.html

package info (click to toggle)
erlang-doc-html 1%3A10.b.1a-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 22,488 kB
  • ctags: 9,933
  • sloc: erlang: 505; ansic: 323; perl: 61; sh: 45; makefile: 39
file content (177 lines) | stat: -rw-r--r-- 3,977 bytes parent folder | download
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.2 -->
<HTML>
<HEAD>
  <TITLE>alarm_handler</TITLE>
  <SCRIPT type="text/javascript" src="../../../../doc/erlresolvelinks.js">
</SCRIPT>
  <STYLE TYPE="text/css">
<!--
    .REFBODY     { margin-left: 13mm }
    .REFTYPES    { margin-left: 8mm }
-->
  </STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
      ALINK="#FF0000">
<!-- refpage -->
<CENTER>
<A HREF="http://www.erlang.se">
  <IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif">
</A>
<H1>alarm_handler</H1>
</CENTER>

<H3>MODULE</H3>
<DIV CLASS=REFBODY>
alarm_handler
</DIV>

<H3>MODULE SUMMARY</H3>
<DIV CLASS=REFBODY>
An Alarm Handling Process
</DIV>

<H3>DESCRIPTION</H3>
<DIV CLASS=REFBODY>

<P>The alarm handler process is a <CODE>gen_event</CODE> event manager
process which 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 start-up, but users are
encouraged to write and install their own handlers.


<P>The simple event handler sends all alarms as info reports to
the error logger, and saves all of them in a list which can be
passed to a user defined event handler, which may be installed at
a later stage. The list can grow large if many alarms are
generated. So it is a good reason to install a better user defined
handler.


<P>There are functions to set and clear alarms. The format of
alarms are defined by the user. For example, an event handler
for SNMP could be defined, together with an alarm MIB.


<P>The alarm handler is part of the SASL application. 


<P>When writing new event handlers for the alarm handler, the
following events must be handled:


<P>
<DL>

<DT>
<CODE>{set_alarm, {AlarmId, AlarmDescr}}</CODE>
</DT>

<DD>
This event is generated by
         <CODE>alarm_handler:set_alarm({AlarmId, AlarmDecsr})</CODE>.
         
<BR>

</DD>

<DT>
<CODE>{clear_alarm, AlarmId}</CODE>
</DT>

<DD>
This event is
         generated by <CODE>alarm_handler:clear_alarm(AlarmId)</CODE>.
         
<BR>

</DD>

</DL>

<P>The default simple handler is called <CODE>alarm_handler</CODE> and
it may be exchanged by calling <CODE>gen_event:swap_handler/3</CODE>
as <CODE>gen_event:swap_handler(alarm_handler, {alarm_handler,
swap}, {NewHandler, Args})</CODE>. <CODE>NewHandler:init({Args,
{alarm_handler, Alarms}})</CODE> is called. Refer to gen_event(3)
for further details.




</DIV>

<H3>EXPORTS</H3>

<P><A NAME="clear_alarm/1"><STRONG><CODE>clear_alarm(AlarmId) -&#62; void()</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>AlarmId = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Clears all alarms with id <CODE>AlarmId</CODE>.
         

</DIV>

<P><A NAME="get_alarms/0"><STRONG><CODE>get_alarms() -&#62; [alarm()]</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY>

<P>Returns a list of all active alarms. This function can only
         be used when the simple handler is installed.
         

</DIV>

<P><A NAME="set_alarm/1"><STRONG><CODE>set_alarm(alarm())</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>alarm() = {AlarmId, AlarmDescription}</CODE></STRONG><BR>
<STRONG><CODE>AlarmId = term()</CODE></STRONG><BR>
<STRONG><CODE>AlarmDescription = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Sets an alarm with id <CODE>AlarmId</CODE>. This id is used at a
         later stage when the alarm is cleared.
         

</DIV>

<H3>See Also</H3>
<DIV CLASS=REFBODY>

<P>error_logger(3), gen_event(3) 


</DIV>

<H3>AUTHORS</H3>
<DIV CLASS=REFBODY>
Martin Bjrklund - support@erlang.ericsson.se<BR>

</DIV>
<CENTER>
<HR>
<SMALL>sasl 2.0<BR>
Copyright &copy; 1991-2004
<A HREF="http://www.erlang.se">Ericsson AB</A><BR>
</SMALL>
</CENTER>
</BODY>
</HTML>