File: snmp.html

package info (click to toggle)
erlang-doc-html 1%3A11.b.2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 23,284 kB
  • ctags: 10,724
  • sloc: erlang: 505; ansic: 323; makefile: 62; perl: 61; sh: 45
file content (480 lines) | stat: -rw-r--r-- 14,166 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.3 -->
<HTML>
<HEAD>
  <TITLE>snmp</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>snmp</H1>
</CENTER>

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

<H3>MODULE SUMMARY</H3>
<DIV CLASS=REFBODY>
 Interface functions to the SNMP toolkit

</DIV>

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

<P>The module <CODE>snmp</CODE> contains interface functions to the 
SNMP toolkit.
</DIV>

<H3>Common Data Types</H3>
<DIV CLASS=REFBODY>

<P>The following datatypes are used in the functions below:


<P>
<UL>

<LI>
<CODE>oid() = [byte()]</CODE>
<BR>

</LI>


</UL>

<P>The <CODE>oid()</CODE> type is used to represent an ASN.1 OBJECT
IDENTIFIER.


</DIV>

<H3>EXPORTS</H3>

<P><A NAME="config/0"><STRONG><CODE>config() -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY>

<P>A simple interactive configuration tool. Simple
         configuration files can be generated, but more complex
         configurations still have to be edited manually.
         
        
<P>The tool is a textual based tool that asks some questions
         and generates <CODE>sys.config</CODE> and <CODE>*.conf</CODE> files.
         
        
<P>Note that if the application shall support version 3, then the 
         crypto app must be started before running this function 
         (password generation).<A NAME="start"><!-- Empty --></A>
</DIV>

<P><A NAME="start/0"><STRONG><CODE>start() -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>
<A NAME="start/1"><STRONG><CODE>start(Type) -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>

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

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Starts the SNMP application.
<P>See <A HREF="javascript:erlhref('../../../../', 'kernel', 'application.html');">application</A> for more info.<A NAME="start_agent"><!-- Empty --></A>
</DIV>

<P><A NAME="start_agent/0"><STRONG><CODE>start_agent() -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>
<A NAME="start_agent/1"><STRONG><CODE>start_agent(Type) -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>

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

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>The SNMP application consists of several entities, of which the
         agent is one. This function starts the agent entity of the 
         application. 
         
        
<P>Note that the only way to actually start the agent in this way is
to add the agent related config after starting the application (e.g
it cannot be part of the normal application config; sys.config).
This is done by calling: 
<CODE>application:set_env(snmp, agent, Conf)</CODE>.
         
        
<P>The default value for <CODE>Type</CODE> is <CODE>normal</CODE>.
         
        <A NAME="start_manager"><!-- Empty --></A> 

</DIV>

<P><A NAME="start_manager/0"><STRONG><CODE>start_manager() -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>
<A NAME="start_manager/1"><STRONG><CODE>start_manager(Type) -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>

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

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>The SNMP application consists of several entities, of which the
         manager is one. This function starts the manager entity of the 
         application. 
         
        
<P>Note that the only way to actually start the manager in this way is
to add the manager related config after starting the application (e.g
it cannot be part of the normal application config; sys.config).
This is done by calling: 
<CODE>application:set_env(snmp, manager, Conf)</CODE>.
         
        
<P>The default value for <CODE>Type</CODE> is <CODE>normal</CODE>.
         
        <A NAME="versions1"><!-- Empty --></A> 
        <A NAME="versions2"><!-- Empty --></A> 

</DIV>

<P><A NAME="versions1/0"><STRONG><CODE>versions1() -&#62; {ok, Info} | {error, Reason}</CODE></STRONG></A><BR>
<A NAME="versions2/0"><STRONG><CODE>versions2() -&#62; {ok, Info} | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Info = [info()]</CODE></STRONG><BR>
<STRONG><CODE>info() = term()</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Utility functions used to retreive some system and
         application info.
<P>The difference between the two functions is in how they get
         the modules to check. <CODE>versions1</CODE> uses the app-file and
         <CODE>versions2</CODE> uses the function <CODE>application:get_key</CODE>.

         <A NAME="print_version_info"><!-- Empty --></A> 

</DIV>

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

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Prefix = string() | integer()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Utility function(s) to produce a formated printout of the versions
info generated by the <CODE>versions1</CODE> function
<P>This is the same as doing, e.g.: 
<PRE>
           {ok, V} = snmp:versions1(), 
           snmp:print_versions(V).
        
</PRE>
<A NAME="print_versions"><!-- Empty --></A>
</DIV>

<P><A NAME="print_versions/1"><STRONG><CODE>print_versions(VersionInfo) -&#62; void()</CODE></STRONG></A><BR>
<A NAME="print_versions/2"><STRONG><CODE>print_versions(Prefix, VersionInfo) -&#62; void()</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>VersionInfo = [version_info()]</CODE></STRONG><BR>
<STRONG><CODE>version_info() = term()</CODE></STRONG><BR>
<STRONG><CODE>Prefix = string() | integer()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Utility function to produce a formated printout of the versions
info generated by the <CODE>versions1</CODE> and <CODE>versions2</CODE>
functions
<P>Example: 
<PRE>
           {ok, V} = snmp:versions1(), 
           snmp:print_versions(V).
        
</PRE>
<A NAME="dat"><!-- Empty --></A>
</DIV>

<P><A NAME="date_and_time/0"><STRONG><CODE>date_and_time() -&#62; DateAndTime</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>DateAndTime = [int()]</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Returns current date and time as the data type DateAndTime,
         as specified in RFC1903. This is an OCTET STRING.

         <A NAME="dat2ut_dst"><!-- Empty --></A> 

</DIV>

<P><A NAME="date_and_time_to_universal_time_dst/1"><STRONG><CODE>date_and_time_to_universal_time_dst(DateAndTime) -&#62; [utc()]</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>DateAndTime = [int()]</CODE></STRONG><BR>
<STRONG><CODE>utc() = {{Y,Mo,D},{H,M,S}}</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Converts a DateAndTime list to a list of possible universal 
         time(s). The unversal time value on the same format as defined in
        calendar(3).

         <A NAME="dat2s"><!-- Empty --></A> 

</DIV>

<P><A NAME="date_and_time_to_string/1"><STRONG><CODE>date_and_time_to_string(DateAndTime) -&#62; string()</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>DateAndTime = [int()]</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Converts a DateAndTime list to a printable string, according
to the DISPLAY-HINT definition in RFC1903.

        <A NAME="lt2dat_dst"><!-- Empty --></A> 

</DIV>

<P><A NAME="local_time_to_date_and_time_dst/1"><STRONG><CODE>local_time_to_date_and_time_dst(Local) -&#62; [DateAndTime]</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Local = {{Y,Mo,D},{H,M,S}}</CODE></STRONG><BR>
<STRONG><CODE>DateAndTime = [int()]</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Converts a local time value to a list of possible DateAndTime 
         list(s). The local time value on the same format as defined in 
         calendar(3).

         <A NAME="ut2dat"><!-- Empty --></A> 

</DIV>

<P><A NAME="universal_time_to_date_and_time/1"><STRONG><CODE>universal_time_to_date_and_time(UTC) -&#62; DateAndTime</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>UTC = {{Y,Mo,D},{H,M,S}}</CODE></STRONG><BR>
<STRONG><CODE>DateAndTime = [int()]</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Converts a universal time value to a DateAndTime list. The
        unversal time value on the same format as defined in calendar(3).

         <A NAME="vdat"><!-- Empty --></A> 

</DIV>

<P><A NAME="validate_date_and_time/1"><STRONG><CODE>validate_date_and_time(DateAndTime) -&#62; bool()</CODE></STRONG></A><BR>

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

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Checks if <CODE>DateAndTime</CODE> is a correct DateAndTime
         value, as specified in RFC1903. This function can be used in
         instrumentation functions to validate a DateAndTime value.<A NAME="log_to_txt"><!-- Empty --></A>
</DIV>

<P><A NAME="log_to_txt/5"><STRONG><CODE>log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile) -&#62; 
        ok | {error, Reason}</CODE></STRONG></A><BR>
<A NAME="log_to_txt/6"><STRONG><CODE>log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start) -&#62; 
        ok | {error, Reason}</CODE></STRONG></A><BR>
<A NAME="log_to_txt/7"><STRONG><CODE>log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop) -&#62;
        ok | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>LogDir = string()</CODE></STRONG><BR>
<STRONG><CODE>Mibs = [MibName]</CODE></STRONG><BR>
<STRONG><CODE>OutFile = string()</CODE></STRONG><BR>
<STRONG><CODE>MibName = string()</CODE></STRONG><BR>
<STRONG><CODE>LogName = string()</CODE></STRONG><BR>
<STRONG><CODE>LogFile = string()</CODE></STRONG><BR>
<STRONG><CODE>Start = Stop = null | datetime() | {local_time,datetime()} | 
{universal_time,datetime()} </CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Converts an Audit Trail Log to a readable text file, where
         each item has a trailing TAB character, and any TAB
         character in the body of an item has been replaced by ESC
         TAB.

        
<P>The function can be used on a running system, or by copying
         the entire log directory and calling this function. SNMP
         must be running in order to provide MIB information.

        
<P><CODE>LogDir</CODE> is the name of the directory where the audit
         trail log is stored. 
         <CODE>Mibs</CODE> is a list of Mibs to be used. The function uses 
         the information in the Mibs to convert for example object 
         identifiers to their symbolic name. 
         <CODE>OutFile</CODE> is the name of the generated textfile.
         <CODE>LogName</CODE> is the name of the log, 
         <CODE>LogFile</CODE> is the name of the log file. 
         <CODE>Start</CODE> is the start (first) date and time from which 
         log events will be converted and 
         <CODE>Stop</CODE> is the stop (last) date and time to which log 
         events will be converted.

        
<P>The format of an audit trail log text item is as follows:

        
<P><CODE>Tag Addr - Community [TimeStamp] Vsn</CODE><BR>
<CODE>PDU</CODE>

        
<P>where <CODE>Tag</CODE> is <CODE>request</CODE>, <CODE>response</CODE>, 
         <CODE>report</CODE>, <CODE>trap</CODE> or <CODE>inform</CODE>; Addr is 
         <CODE>IP:Port</CODE> (or comma space separated list of such);
         <CODE>Community</CODE> is the community parameter (SNMP version
         v1 and v2), or <CODE>SecLevel:&#34;AuthEngineID&#34;:&#34;UserName&#34;</CODE>
         (SNMP v3); <CODE>TimeStamp</CODE> is a date and time stamp,
         and <CODE>Vsn</CODE> is the SNMP version. <CODE>PDU</CODE> is a textual
         version of the protocol data unit. There is a new line
         between <CODE>Vsn</CODE> and <CODE>PDU</CODE>.

         <A NAME="change_log_size"><!-- Empty --></A> 

</DIV>

<P><A NAME="change_log_size/2"><STRONG><CODE>change_log_size(LogName, NewSize) -&#62; ok | {error, Reason}</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>LogName = string()</CODE></STRONG><BR>
<STRONG><CODE>NewSize = {MaxBytes, MaxFiles}</CODE></STRONG><BR>
<STRONG><CODE>MaxBytes = integer()</CODE></STRONG><BR>
<STRONG><CODE>MaxFiles = integer()</CODE></STRONG><BR>
<STRONG><CODE>Reason = term()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Changes the log size of the Audit Trail Log. The
         application must be configured to use the audit trail log
         function. Please refer to disk_log(3) in Kernel Reference 
         Manual for a description of how to change the log size.

        
<P>The change is permanent, as long as the log is not deleted. 
         That means, the log size is remebered across reboots.

</DIV>

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

<P>calendar(3)


</DIV>

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

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