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
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
|
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">
<erlref>
<header>
<copyright>
<year>2004</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
The contents of this file are subject to the Erlang Public License,
Version 1.1, (the "License"); you may not use this file except in
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
</legalnotice>
<title>snmpm</title>
<prepared></prepared>
<responsible></responsible>
<docno></docno>
<approved></approved>
<checked></checked>
<date></date>
<rev></rev>
<file>snmpm.xml</file>
</header>
<module>snmpm</module>
<modulesummary>Interface functions to the SNMP toolkit manager</modulesummary>
<description>
<p>The module <c>snmpm</c> contains interface functions to the
SNMP manager. </p>
</description>
<section>
<title>Common Data Types</title>
<p>The following data types are used in the functions below:</p>
<code type="none"><![CDATA[
oid() = [byte()] - The oid() type is used to represent an ASN.1 OBJECT IDENTIFIER
snmp_reply() = {error_status(), error_index(), varbinds()}
error_status() = noError | atom()
error_index() = integer()
varbinds() = [varbind()]
atl_type() = read | write | read_write
target_name() = string() - Is a unique *non-empty* string
vars_and_vals() = [var_and_val()]
var_and_val() = {oid(), value_type(), value()} | {oid(), value()}
value_type() = o ('OBJECT IDENTIFIER') |
i ('INTEGER') |
u ('Unsigned32') |
g ('Unsigned32') |
s ('OCTET SRING') |
b ('BITS') |
ip ('IpAddress') |
op ('Opaque') |
c32 ('Counter32') |
c64 ('Counter64') |
tt ('TimeTicks')
value() = term()
community() = string()
sec_model() = any | v1 | v2c | usm
sec_name() = string()
sec_level() = noAuthNoPriv | authNoPriv | authPriv
]]></code>
<marker id="monitor"></marker>
</section>
<funcs>
<func>
<name>monitor() -> Ref</name>
<fsummary>Monitor the snmp manager</fsummary>
<type>
<v>Ref = reference()</v>
</type>
<desc>
<p>Monitor the SNMP manager. In case of a crash, the calling
(monitoring) process will get a 'DOWN' message (see the erlang
module for more info). </p>
<marker id="demonitor"></marker>
</desc>
</func>
<func>
<name>demonitor(Ref) -> void()</name>
<fsummary>Turn off monitoring of the snmp manager</fsummary>
<type>
<v>Ref = reference()</v>
</type>
<desc>
<p>Turn off monitoring of the SNMP manager. </p>
<marker id="notify_started"></marker>
</desc>
</func>
<func>
<name>notify_started(Timeout) -> Pid</name>
<fsummary>Request to be notified when manager started</fsummary>
<type>
<v>Timeout = integer()</v>
<v>Pid = pid()</v>
</type>
<desc>
<p>Request a notification (message) when the SNMP manager has
started. </p>
<p>The <c>Timeout</c> is the time the request is valid. The
value has to be greater then zero. </p>
<p>The <c>Pid</c> is the process handling the supervision of the
SNMP manager start. When the manager has started a completion
message will be sent to the client from this process:
<c>{snmpm_started, Pid}</c>. If the SNMP manager was not started
in time, a timeout message will be sent to the client:
<c>{snmpm_start_timeout, Pid}</c>. </p>
<p>A client application that is dependent on the SNMP manager
will use this function in order to be notified of when the
manager has started. There are two situations when this
is useful:</p>
<list type="bulleted">
<item>
<p>During the start of a system, when a client application
<em>could</em> start prior to the SNMP manager but is dependent
upon it, and therefor has to wait for it to start.</p>
</item>
<item>
<p>When the SNMP manager has crashed, the dependent client
application has to wait for the SNMP manager to be restarted
before it can <em>reconnect</em>.</p>
</item>
</list>
<p>The function returns the pid() of a handler process, that does
the supervision on behalf of the client application. Note that the
client application is linked to this handler. </p>
<p>This function is used in conjunction with the monitor function.</p>
<marker id="cancel_notify_started"></marker>
</desc>
</func>
<func>
<name>cancel_notify_started(Pid) -> void()</name>
<fsummary>Cancel request to be notified when manager started</fsummary>
<type>
<v>Pid = pid()</v>
</type>
<desc>
<p>Cancel a previous request to be notified of SNMP manager start.</p>
<marker id="register_user"></marker>
</desc>
</func>
<func>
<name>register_user(Id, Module, Data) -> ok | {error, Reason}</name>
<name>register_user(Id, Module, Data, DefaultAgentConfig) -> ok | {error, Reason}</name>
<fsummary>Register a user of the manager</fsummary>
<type>
<v>Id = term()</v>
<v>Module = snmpm_user()</v>
<v>Data = term()</v>
<v>DefaultAgentConfig = [default_agent_config()]</v>
<v>default_agent_config() = {Item, Val}</v>
<v>Item = community | timeout | max_message_size | version | sec_model | sec_name | sec_level</v>
<v>Val = term()</v>
<v>Reason = term()</v>
<v>snmpm_user() = Module implementing the snmpm_user behaviour</v>
</type>
<desc>
<p>Register the manager entity (=user) responsible for specific
agent(s). </p>
<p><c>Module</c> is the callback module (snmpm_user behaviour) which
will be called whenever something happens (detected
agent, incoming reply or incoming trap/notification).
Note that this could have already been done as a
consequence of the node config. (see users.conf).</p>
<p>The argument <c>DefaultAgentConfig</c> is used as default values when
this user register agents.</p>
<p>The type of <c>Val</c> depends on <c>Item</c>: </p>
<code type="none"><![CDATA[
community = string()
timeout = integer() | snmp_timer()
max_message_size = integer()
version = v1 | v2 | v3
sec_model = any | v1 | v2c | usm
sec_name = string()
sec_level = noAuthNoPriv | authNoPriv | authPriv
]]></code>
<marker id="register_user_monitor"></marker>
</desc>
</func>
<func>
<name>register_user_monitor(Id, Module, Data) -> ok | {error, Reason}</name>
<name>register_user_monitor(Id, Module, Data, DefaultAgentConfig) -> ok | {error, Reason}</name>
<fsummary>Register a monitored user of the manager</fsummary>
<type>
<v>Id = term()</v>
<v>Module = snmpm_user()</v>
<v>DefaultAgentConfig = [default_agent_config()]</v>
<v>default_agent_config() = {Item, Val}</v>
<v>Item = community | timeout | max_message_size | version | sec_model | sec_name | sec_level</v>
<v>Val = term()</v>
<v>Data = term()</v>
<v>Reason = term()</v>
<v>snmpm_user() = Module implementing the snmpm_user behaviour</v>
</type>
<desc>
<p>Register the monitored manager entity (=user) responsible
for specific agent(s). </p>
<p>The process performing the registration will be monitored.
Which means that if that process should die, all agents
registered by that user process will be unregistered. All
outstanding requests will be canceled. </p>
<p><c>Module</c> is the callback module (snmpm_user behaviour) which
will be called whenever something happens (detected
agent, incoming reply or incoming trap/notification).
Note that this could have already been done as a
consequence of the node config. (see users.conf).</p>
<p>The argument <c>DefaultAgentConfig</c> is used as default values when
this user register agents.</p>
<p>The type of <c>Val</c> depends on <c>Item</c>: </p>
<code type="none"><![CDATA[
community = string()
timeout = integer() | snmp_timer()
max_message_size = integer()
version = v1 | v2 | v3
sec_model = any | v1 | v2c | usm
sec_name = string()
sec_level = noAuthNoPriv | authNoPriv | authPriv
]]></code>
<marker id="unregister_user"></marker>
</desc>
</func>
<func>
<name>unregister_user(Id) -> ok | {error, Reason}</name>
<fsummary>Unregister the user</fsummary>
<type>
<v>Id = term()</v>
</type>
<desc>
<p>Unregister the user.</p>
<marker id="which_users"></marker>
</desc>
</func>
<func>
<name>which_users() -> Users</name>
<fsummary>Get a list of all users</fsummary>
<type>
<v>Users = [UserId]</v>
<v>UserId = term()</v>
</type>
<desc>
<p>Get a list of the identities of all registered users.</p>
<marker id="register_agent"></marker>
</desc>
</func>
<func>
<name>register_agent(UserId, TargetName, Config) -> ok | {error, Reason}</name>
<fsummary>Register this agent</fsummary>
<type>
<v>UserId = term()</v>
<v>Addr = ip_address()</v>
<v>TargetName = target_name()</v>
<v>Config = [agent_config()]</v>
<v>agent_config() = {Item, Val}</v>
<v>Item = engine_id | address | port | community | timeout | max_message_size | version | sec_model | sec_name | sec_level</v>
<v>Val = term()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Explicitly instruct the manager to handle this agent, with
<c>UserId</c> as the responsible user. </p>
<p>Called to instruct the manager that this agent
shall be handled. This function is used when
the user knows in advance which agents the
manager shall handle.
Note that there is an alternate way to do the same thing:
Add the agent to the manager config files (see
<seealso marker="snmp_manager_config_files#agents">agents.conf</seealso>).</p>
<p><c>TargetName</c> is a non-empty string,
uniquely identifying the agent. </p>
<p>The type of <c>Val</c> depends on <c>Item</c>: </p>
<code type="none"><![CDATA[
[mandatory] engine_id = string()
[mandatory] address = ip_address()
[optional] port = integer()
[optional] community = string()
[optional] timeout = integer() | snmp_timer()
[optional] max_message_size = integer()
[optional] version = v1 | v2 | v3
[optional] sec_model = any | v1 | v2c | usm
[optional] sec_name = string()
[optional] sec_level = noAuthNoPriv | authNoPriv | authPriv
]]></code>
<p>Note that if no <c>Port</c> is given, the default value is used.</p>
<marker id="unregister_agent"></marker>
</desc>
</func>
<func>
<name>unregister_agent(UserId, TargetName) -> ok | {error, Reason}</name>
<fsummary>Unregister the user</fsummary>
<type>
<v>UserId = term()</v>
<v>TargetName = target_name()</v>
</type>
<desc>
<p>Unregister the agent.</p>
<marker id="agent_info"></marker>
</desc>
</func>
<func>
<name>agent_info(TargetName, Item) -> {ok, Val} | {error, Reason}</name>
<fsummary>Retrieve agent config</fsummary>
<type>
<v>TargetName = target_name()</v>
<v>Item = atom()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Retrieve agent config.</p>
<marker id="update_agent_info"></marker>
</desc>
</func>
<func>
<name>update_agent_info(UserId, TargetName, Item, Val) -> ok | {error, Reason}</name>
<fsummary>Update agent config</fsummary>
<type>
<v>UserId = term()</v>
<v>TargetName = target_name()</v>
<v>Item = atom()</v>
<v>Val = term()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Update agent config.</p>
<marker id="which_agents"></marker>
</desc>
</func>
<func>
<name>which_agents() -> Agents</name>
<name>which_agents(UserId) -> Agents</name>
<fsummary>List the registered agents</fsummary>
<type>
<v>UserId = term()</v>
<v>Agents = [TargetName]</v>
<v>TargetName = target_name()</v>
</type>
<desc>
<p>Get a list of all registered agents or all agents registered
by a specific user.</p>
<marker id="register_usm_user"></marker>
</desc>
</func>
<func>
<name>register_usm_user(EngineID, UserName, Conf) -> ok | {error, Reason}</name>
<fsummary>Register this USM user</fsummary>
<type>
<v>EngineID = string()</v>
<v>UserName = string()</v>
<v>Conf = [usm_config()]</v>
<v>usm_config() = {Item, Val}</v>
<v>Item = sec_name | auth | auth_key | priv | priv_key</v>
<v>Val = term()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Explicitly instruct the manager to handle this USM user.
Note that there is an alternate way to do the same thing:
Add the usm user to the manager config files (see
<seealso marker="snmp_manager_config_files#usm_user">usm.conf</seealso>).</p>
<p>The type of <c>Val</c> depends on <c>Item</c>: </p>
<code type="none"><![CDATA[
sec_name = string()
auth = usmNoAuthProtocol | usmHMACMD5AuthProtocol | usmHMACSHAAuthProtocoltimeout
auth_key = [integer()] (length 16 if auth = usmHMACMD5AuthProtocol,
length 20 if auth = usmHMACSHAAuthProtocol)
priv = usmNoPrivProtocol | usmDESPrivProtocol | usmAesCfb128Protocol
priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb128Protocol).
]]></code>
<marker id="unregister_usm_user"></marker>
</desc>
</func>
<func>
<name>unregister_usm_user(EngineID, UserName) -> ok | {error, Reason}</name>
<fsummary>Unregister this USM user</fsummary>
<type>
<v>EngineID = string()</v>
<v>UserName = string()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Unregister this USM user.</p>
<marker id="which_usm_users1"></marker>
</desc>
</func>
<func>
<name>usm_user_info(EngineID, UserName, Item) -> {ok, Val} | {error, Reason}</name>
<fsummary>Retrieve usm user config</fsummary>
<type>
<v>EngineID = string()</v>
<v>UsmName = string()</v>
<v>Item = sec_name | auth | auth_key | priv | priv_key</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Retrieve usm user config.</p>
<marker id="update_usm_user_info"></marker>
</desc>
</func>
<func>
<name>update_usm_user_info(EngineID, UserName, Item, Val) -> ok | {error, Reason}</name>
<fsummary>Update agent config</fsummary>
<type>
<v>EngineID = string()</v>
<v>UsmName = string()</v>
<v>Item = sec_name | auth | auth_key | priv | priv_key</v>
<v>Val = term()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Update usm user config.</p>
<marker id="which_usm_users"></marker>
</desc>
</func>
<func>
<name>which_usm_users() -> UsmUsers</name>
<fsummary>List all the registered usm users</fsummary>
<type>
<v>UsmUsers = [{EngineID,UserName}]</v>
<v>EngineID = string()</v>
<v>UsmName = string()</v>
</type>
<desc>
<p>Get a list of all registered usm users.</p>
<marker id="which_usm_users2"></marker>
</desc>
</func>
<func>
<name>which_usm_users(EngineID) -> UsmUsers</name>
<fsummary>List the registered usm users</fsummary>
<type>
<v>UsmUsers = [UserName]</v>
<v>UserName = string()</v>
</type>
<desc>
<p>Get a list of all registered usm users with engine-id
<c>EngineID</c>.</p>
<marker id="sync_get"></marker>
</desc>
</func>
<func>
<name>sync_get(UserId, TargetName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
<name>sync_get(UserId, TargetName, Oids, SendOpts) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
<fsummary>Synchronous <c>get-request</c></fsummary>
<type>
<v>UserId = term()</v>
<v>TargetName = target_name()</v>
<v>Oids = [oid()]</v>
<v>SendOpts = send_opts()</v>
<v>send_opts() = [send_opt()]</v>
<v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
<v>SnmpReply = snmp_reply()</v>
<v>Remaining = integer()</v>
<v>Reason = {send_failed, ReqId, ActualReason} | {invalid_sec_info, SecInfo, SnmpInfo} | term()</v>
<v>ReqId = term()</v>
<v>ActualReason = term()</v>
<v>SecInfo = [sec_info()]</v>
<v>sec_info() = {sec_tag(), ExpectedValue, ReceivedValue}</v>
<v>sec_tag() = atom()</v>
<v>ExpectedValue = ReceivedValue = term()</v>
<v>SnmpInfo = term()</v>
</type>
<desc>
<p>Synchronous <c>get-request</c>. </p>
<p><c>Remaining</c> is the remaining time of the given (or default)
timeout time.</p>
<p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
the net_if process failed to send the message. This could happen
because of any number of reasons, i.e. encoding error.
<em>ActualReason</em> is the actual reason in this case. </p>
<p>The send option <c>extra</c> specifies an opaque data structure
passed on to the net-if process. The net-if process included in this
application makes no use of this info, so the only use for it
in such a option (when using the built in net-if) would
be tracing.</p>
<p>Some of the send options (<c>community</c>, <c>sec_model</c>,
<c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
are <c>override options</c>. That is,
for <em>this</em> request, they override any configuration done
when the agent was registered. </p>
<p>For <c>SnmpInfo</c>, see the user callback function
<seealso marker="snmpm_user#handle_report">handle_report</seealso>.</p>
<marker id="async_get"></marker>
</desc>
</func>
<func>
<name>async_get(UserId, TargetName, Oids) -> {ok, ReqId} | {error, Reason}</name>
<name>async_get(UserId, TargetName, Oids, SendOpts) -> {ok, ReqId} | {error, Reason}</name>
<fsummary>Asynchronous <c>get-request</c></fsummary>
<type>
<v>UserId = term()</v>
<v>TargetName = target_name()</v>
<v>Oids = [oid()]</v>
<v>SendOpts = send_opts()</v>
<v>send_opts() = [send_opt()]</v>
<v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
<v>ReqId = term()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Asynchronous <c>get-request</c>.</p>
<p>The reply, if it arrives, will be delivered to the user
through a call to the snmpm_user callback function
<c>handle_pdu</c>.</p>
<p>The send option <c>timeout</c> specifies for how long the request is
valid (after which the manager is free to delete it).</p>
<p>The send option <c>extra</c> specifies an opaque data structure
passed on to the net-if process. The net-if process included in this
application makes no use of this info, so the only use for it
in such a configuration (when using the built in net-if) would
be tracing.</p>
<p>Some of the send options (<c>community</c>, <c>sec_model</c>,
<c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
are <c>override options</c>. That is,
for <em>this</em> request, they override any configuration done
when the agent was registered. </p>
<marker id="sync_get_next"></marker>
</desc>
</func>
<func>
<name>sync_get_next(UserId, TargetName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
<name>sync_get_next(UserId, TargetName, Oids, SendOpts) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
<fsummary>Synchronous <c>get-next-request</c></fsummary>
<type>
<v>UserId = term()</v>
<v>TargetName = target_name()</v>
<v>Oids = [oid()]</v>
<v>SendOpts = send_opts()</v>
<v>send_opts() = [send_opt()]</v>
<v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
<v>SnmpReply = snmp_reply()</v>
<v>Remaining = integer()</v>
<v>Reason = {send_failed, ReqId, ActualReason} | {invalid_sec_info, SecInfo, SnmpInfo} | term()</v>
<v>ReqId = term()</v>
<v>ActualReason = term()</v>
<v>SecInfo = [sec_info()]</v>
<v>sec_info() = {sec_tag(), ExpectedValue, ReceivedValue}</v>
<v>sec_tag() = atom()</v>
<v>ExpectedValue = ReceivedValue = term()</v>
<v>SnmpInfo = term()</v>
</type>
<desc>
<p>Synchronous <c>get-next-request</c>. </p>
<p><c>Remaining</c> is the remaining time of the given (or default)
timeout time.</p>
<p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
the net_if process failed to send the message. This could happen
because of any number of reasons, i.e. encoding error.
<em>ActualReason</em> is the actual reason in this case. </p>
<p>The send option <c>extra</c> specifies an opaque data structure
passed on to the net-if process. The net-if process included in this
application makes no use of this info, so the only use for it
in such a configuration (when using the built in net-if) would
be tracing.</p>
<p>Some of the send options (<c>community</c>, <c>sec_model</c>,
<c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
are <c>override options</c>. That is,
for <em>this</em> request, they override any configuration done
when the agent was registered. </p>
<p>For <c>SnmpInfo</c>, see the user callback function
<seealso marker="snmpm_user#handle_report">handle_report</seealso>.</p>
<marker id="async_get_next"></marker>
</desc>
</func>
<func>
<name>async_get_next(UserId, TargetName, Oids) -> {ok, ReqId} | {error, Reason}</name>
<name>async_get_next(UserId, TargetName, Oids, SendOpts) -> {ok, ReqId} | {error, Reason}</name>
<fsummary>Asynchronous <c>get-next-request</c></fsummary>
<type>
<v>UserId = term()</v>
<v>TargetName = target_name()</v>
<v>Oids = [oid()]</v>
<v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
<v>ReqId = integer()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Asynchronous <c>get-next-request</c>. </p>
<p>The reply will be delivered to the user through a call
to the snmpm_user callback function <c>handle_pdu</c>.</p>
<p>The send option <c>timeout</c> specifies for how long the request is
valid (after which the manager is free to delete it).</p>
<p>The send option <c>extra</c> specifies an opaque data structure
passed on to the net-if process. The net-if process included in this
application makes no use of this info, so the only use for it
in such a configuration (when using the built in net-if) would
be tracing.</p>
<p>Some of the send options (<c>community</c>, <c>sec_model</c>,
<c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
are <c>override options</c>. That is,
for <em>this</em> request, they override any configuration done
when the agent was registered. </p>
<marker id="sync_set"></marker>
</desc>
</func>
<func>
<name>sync_set(UserId, TargetName, VarsAndVals) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
<name>sync_set(UserId, TargetName, VarsAndVals, SendOpts) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
<fsummary>Synchronous <c>set-request</c></fsummary>
<type>
<v>UserId = term()</v>
<v>TargetName = target_name()</v>
<v>VarsAndVals = vars_and_vals()</v>
<v>SendOpts = send_opts()</v>
<v>send_opts() = [send_opt()]</v>
<v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
<v>SnmpReply = snmp_reply()</v>
<v>Remaining = integer()</v>
<v>Reason = {send_failed, ReqId, ActualReason} | {invalid_sec_info, SecInfo, SnmpInfo} | term()</v>
<v>ReqId = term()</v>
<v>ActualReason = term()</v>
<v>SecInfo = [sec_info()]</v>
<v>sec_info() = {sec_tag(), ExpectedValue, ReceivedValue}</v>
<v>sec_tag() = atom()</v>
<v>ExpectedValue = ReceivedValue = term()</v>
<v>SnmpInfo = term()</v>
</type>
<desc>
<p>Synchronous <c>set-request</c>. </p>
<p><c>Remaining</c> is the remaining time of the given (or default)
timeout time.</p>
<p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
the net_if process failed to send the message. This could happen
because of any number of reasons, i.e. encoding error.
<em>ActualReason</em> is the actual reason in this case. </p>
<p>When <em>var_and_val()</em> is <em>{oid(), value()}</em>, the
manager makes an educated guess based on the loaded mibs. </p>
<p>The send option <c>extra</c> specifies an opaque data structure
passed on to the net-if process. The net-if process included in this
application makes no use of this info, so the only use for it
in such a configuration (when using the built in net-if) would
be tracing. </p>
<p>Some of the send options (<c>community</c>, <c>sec_model</c>,
<c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
are <c>override options</c>. That is,
for <em>this</em> request, they override any configuration done
when the agent was registered. </p>
<p>For <c>SnmpInfo</c>, see the user callback function
<seealso marker="snmpm_user#handle_report">handle_report</seealso>.</p>
<marker id="async_set"></marker>
</desc>
</func>
<func>
<name>async_set(UserId, TargetName, VarsAndVals) -> {ok, ReqId} | {error, Reason}</name>
<name>async_set(UserId, TargetName, VarsAndVals, SendOpts) -> {ok, ReqId} | {error, Reason}</name>
<fsummary>Asynchronous <c>set-request</c></fsummary>
<type>
<v>UserId = term()</v>
<v>TargetName = target_name()</v>
<v>VarsAndVals = vars_and_vals()</v>
<v>SendOpts = send_opts()</v>
<v>send_opts() = [send_opt()]</v>
<v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
<v>ReqId = term()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Asynchronous <c>set-request</c>. </p>
<p>The reply will be delivered to the user through a call
to the snmpm_user callback function <c>handle_pdu</c>.</p>
<p>The send option <c>timeout</c> specifies for how long the request is
valid (after which the manager is free to delete it).</p>
<p>When <em>var_and_val()</em> is <em>{oid(), value()}</em>, the
manager makes an educated guess based on the loaded mibs. </p>
<p>The send option <c>extra</c> specifies an opaque data structure
passed on to the net-if process. The net-if process included in this
application makes no use of this info, so the only use for it
in such a configuration (when using the built in net-if) would
be tracing.</p>
<p>Some of the send options (<c>community</c>, <c>sec_model</c>,
<c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
are <c>override options</c>. That is,
for <em>this</em> request, they override any configuration done
when the agent was registered. </p>
<marker id="sync_get_bulk"></marker>
</desc>
</func>
<func>
<name>sync_get_bulk(UserId, TragetName, NonRep, MaxRep, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
<name>sync_get_bulk(UserId, TragetName, NonRep, MaxRep, Oids, SendOpts) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
<fsummary>Synchronous <c>get-bulk-request</c></fsummary>
<type>
<v>UserId = term()</v>
<v>TargetName = target_name()</v>
<v>NonRep = integer()</v>
<v>MaxRep = integer()</v>
<v>Oids = [oid()]</v>
<v>SendOpts = send_opts()</v>
<v>send_opts() = [send_opt()]</v>
<v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
<v>SnmpReply = snmp_reply()</v>
<v>Remaining = integer()</v>
<v>Reason = {send_failed, ReqId, ActualReason} | {invalid_sec_info, SecInfo, SnmpInfo} | term()</v>
<v>ReqId = term()</v>
<v>ActualReason = term()</v>
<v>SecInfo = [sec_info()]</v>
<v>sec_info() = {sec_tag(), ExpectedValue, ReceivedValue}</v>
<v>sec_tag() = atom()</v>
<v>ExpectedValue = ReceivedValue = term()</v>
<v>SnmpInfo = term()</v>
</type>
<desc>
<p>Synchronous <c>get-bulk-request</c> (See RFC1905).</p>
<p><c>Remaining</c> is the remaining time of the given (or default)
timeout time.</p>
<p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
the net_if process failed to send the message. This could happen
because of any number of reasons, i.e. encoding error.
<em>ActualReason</em> is the actual reason in this case. </p>
<p>The send option <c>extra</c> specifies an opaque data structure
passed on to the net-if process. The net-if process included in this
application makes no use of this info, so the only use for it
in such a configuration (when using the built in net-if) would
be tracing.</p>
<p>Some of the send options (<c>community</c>, <c>sec_model</c>,
<c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
are <c>override options</c>. That is,
for <em>this</em> request, they override any configuration done
when the agent was registered. </p>
<p>For <c>SnmpInfo</c>, see the user callback function
<seealso marker="snmpm_user#handle_report">handle_report</seealso>.</p>
<marker id="async_get_bulk"></marker>
</desc>
</func>
<func>
<name>async_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids) -> {ok, ReqId} | {error, Reason}</name>
<name>async_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts) -> {ok, ReqId} | {error, Reason}</name>
<fsummary>Asynchronous <c>get-bulk-request</c></fsummary>
<type>
<v>UserId = term()</v>
<v>TargetName = target_name()</v>
<v>NonRep = integer()</v>
<v>MaxRep = integer()</v>
<v>Oids = [oid()]</v>
<v>SendOpts = send_opts()</v>
<v>send_opts() = [send_opt()]</v>
<v>send_opt() = {context, string()} | {timeout, pos_integer()} | {extra, term()} | {community, community()} | {sec_model, sec_model()} | {sec_name, string()} | {sec_level, sec_level()} | {max_message_size, pos_integer()}</v>
<v>ReqId = integer()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Asynchronous <c>get-bulk-request</c> (See RFC1905).</p>
<p>The reply will be delivered to the user through a call
to the snmpm_user callback function <c>handle_pdu</c>.</p>
<p>The send option <c>timeout</c> specifies for how long the request is
valid (after which the manager is free to delete it).</p>
<p>The send option <c>extra</c> specifies an opaque data structure
passed on to the net-if process. The net-if process included in this
application makes no use of this info, so the only use for it
in such a configuration (when using the built in net-if) would
be tracing.</p>
<p>Some of the send options (<c>community</c>, <c>sec_model</c>,
<c>sec_name</c>, <c>sec_level</c> and <c>max_message_size</c>)
are <c>override options</c>. That is,
for <em>this</em> request, they override any configuration done
when the agent was registered. </p>
<marker id="cancel_async_request"></marker>
</desc>
</func>
<func>
<name>cancel_async_request(UserId, ReqId) -> ok | {error, Reason}</name>
<fsummary>Cancel a asynchronous request</fsummary>
<type>
<v>UserId = term()</v>
<v>ReqId = term()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Cancel a previous asynchronous request.</p>
<marker id="log_to_txt"></marker>
</desc>
</func>
<func>
<name>log_to_txt(LogDir, Mibs)</name>
<name>log_to_txt(LogDir, Mibs, OutFile) -> ok | {error, Reason}</name>
<name>log_to_txt(LogDir, Mibs, OutFile, LogName) -> ok | {error, Reason}</name>
<name>log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile) -> ok | {error, Reason}</name>
<name>log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start) -> ok | {error, Reason}</name>
<name>log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop) -> ok | {error, Reason}</name>
<fsummary>Convert an Audit Trail Log to text format</fsummary>
<type>
<v>LogDir = string()</v>
<v>Mibs = [MibName]</v>
<v>MibName = string()</v>
<v>OutFile = string()</v>
<v>LogName = string()</v>
<v>LogFile = string()</v>
<v>Start = Stop = null | datetime() | {local_time,datetime()} | {universal_time,datetime()} </v>
<v>Reason = disk_log_open_error() | file_open_error() | term()</v>
<v>disk_log_open_error() = {LogName, term()}</v>
<v>file_open_error() = {OutFile, term()}</v>
</type>
<desc>
<p>Converts an Audit Trail Log to a readable text file.
<c>OutFile</c> defaults to "./snmpm_log.txt".
<c>LogName</c> defaults to "snmpm_log".
<c>LogFile</c> defaults to "snmpm.log".
See <seealso marker="snmp#log_to_txt">snmp:log_to_txt</seealso>
for more info.</p>
<marker id="change_log_size"></marker>
</desc>
</func>
<func>
<name>change_log_size(NewSize) -> ok | {error, Reason}</name>
<fsummary>Change the size of the Audit Trail Log</fsummary>
<type>
<v>NewSize = {MaxBytes, MaxFiles}</v>
<v>MaxBytes = integer()</v>
<v>MaxFiles = integer()</v>
<v>Reason = term()</v>
</type>
<desc>
<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>
<p>The change is permanent, as long as the log is not deleted.
That means, the log size is remembered across reboots.</p>
<marker id="set_log_type"></marker>
</desc>
</func>
<func>
<name>set_log_type(NewType) -> {ok, OldType} | {error, Reason}</name>
<fsummary>Change the Audit Trail Log type</fsummary>
<type>
<v>NewType = OldType = atl_type()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Changes the run-time Audit Trail log type. </p>
<p>Note that this has no effect on the application configuration as
defined by configuration files, so a node restart will revert the
config to whatever is in those files. </p>
<p>This function is primarily useful in testing/debugging
scenarios. </p>
<marker id="load_mib"></marker>
</desc>
</func>
<func>
<name>load_mib(Mib) -> ok | {error, Reason}</name>
<fsummary>Load a MIB into the manager</fsummary>
<type>
<v>Mib = MibName</v>
<v>MibName = string()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Load a <c>Mib</c> into the manager. The <c>MibName</c> is the
name of the Mib, including the path to where the compiled mib is
found. For example,</p>
<code type="none">
Dir = code:priv_dir(my_app) ++ "/mibs/",
snmpm:load_mib(Dir ++ "MY-MIB").
</code>
<marker id="unload_mib"></marker>
</desc>
</func>
<func>
<name>unload_mib(Mib) -> ok | {error, Reason}</name>
<fsummary>Unload a MIB from the manager</fsummary>
<type>
<v>Mib = MibName</v>
<v>MibName = string()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Unload a <c>Mib</c> from the manager. The <c>MibName</c> is the
name of the Mib, including the path to where the compiled mib is
found. For example,</p>
<code type="none">
Dir = code:priv_dir(my_app) ++ "/mibs/",
snmpm:unload_mib(Dir ++ "MY-MIB").
</code>
<marker id="which_mibs"></marker>
</desc>
</func>
<func>
<name>which_mibs() -> Mibs</name>
<fsummary>Which mibs are loaded into the manager</fsummary>
<type>
<v>Mibs = [{MibName, MibFile}]</v>
<v>MibName = atom()</v>
<v>MibFile = string()</v>
</type>
<desc>
<p>Get a list of all the mib's loaded into the manager.</p>
<marker id="name_to_oid"></marker>
</desc>
</func>
<func>
<name>name_to_oid(Name) -> {ok, Oids} | {error, Reason}</name>
<fsummary>Get all the possible oid's for an alias-name</fsummary>
<type>
<v>Name = atom()</v>
<v>Oids = [oid()]</v>
</type>
<desc>
<p>Transform a alias-name to its oid.</p>
<p>Note that an alias-name is only unique within the mib, so
when loading several mib's into a manager, there might be
several instances of the same aliasname.</p>
<marker id="oid_to_name"></marker>
</desc>
</func>
<func>
<name>oid_to_name(Oid) -> {ok, Name} | {error, Reason}</name>
<fsummary>Get the alias-name of the oid </fsummary>
<type>
<v>Oid = oid()</v>
<v>Name = atom()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Transform a oid to its aliasname.</p>
<marker id="oid_to_type"></marker>
</desc>
</func>
<func>
<name>oid_to_type(Oid) -> {ok, Type} | {error, Reason}</name>
<fsummary>Get the type of the the oid</fsummary>
<type>
<v>Oid = oid()</v>
<v>Type = atom()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Retreive the type (asn1 bertype) of an oid.</p>
<marker id="backup"></marker>
</desc>
</func>
<func>
<name>backup(BackupDir) -> ok | {error, Reason}</name>
<fsummary>Backup manager data</fsummary>
<type>
<v>BackupDir = string()</v>
</type>
<desc>
<p>Backup persistent data handled by the manager. </p>
<p>BackupDir cannot be identical to DbDir. </p>
<marker id="info"></marker>
</desc>
</func>
<func>
<name>info() -> [{Key, Value}]</name>
<fsummary>Return information about the manager</fsummary>
<type>
<v>Key = atom()</v>
<v>Value = term()</v>
</type>
<desc>
<p>Returns a list (a dictionary) containing information about
the manager. Information includes statistics counters,
miscellaneous info about each process (e.g. memory allocation),
and so on.</p>
<marker id="verbosity"></marker>
</desc>
</func>
<func>
<name>verbosity(Ref, Verbosity) -> void()</name>
<fsummary>Assign a new verbosity for the process</fsummary>
<type>
<v>Ref = server | config | net_if | note_store | all</v>
<v>Verbosity = verbosity()</v>
<v>verbosity() = silence | info | log | debug | trace </v>
</type>
<desc>
<p>Sets verbosity for the designated process. For the lowest
verbosity <c>silence</c>, nothing is printed. The higher the
verbosity, the more is printed.</p>
<marker id="format_reason"></marker>
</desc>
</func>
<func>
<name>format_reason(Reason) -> string()</name>
<name>format_reason(Prefix, Reason) -> string()</name>
<fsummary>Assign a new verbosity for the process</fsummary>
<type>
<v>Reason = term()</v>
<v>Prefix = integer() | string()</v>
</type>
<desc>
<p>This utility function is used to create a formatted
(pretty printable) string of the error reason received
from either:
</p>
<list type="bulleted">
<item>
<p>The <c>Reason</c> returned value if any of the
sync/async get/get-next/set/get-bulk
functions returns <c>{error, Reason}</c></p>
</item>
<item>
<p>The <c>Reason</c> parameter in the
<seealso marker="snmpm_user#handle_error">handle_error</seealso> user callback function.</p>
</item>
</list>
<p><c>Prefix</c> should either be an indention string
(e.g. a list of spaces) or a positive integer (which will be used
to create the indention string of that length).</p>
</desc>
</func>
</funcs>
</erlref>
|