1snmpc(3) Erlang Module Definition snmpc(3)
2
3
4
6 snmpc - Interface Functions to the SNMP toolkit MIB compiler
7
9 The module snmpc contains interface functions to the SNMP toolkit MIB
10 compiler.
11
13 compile(File)
14 compile(File, Options) -> {ok, BinFileName} | {error, Reason}
15
16 Types:
17
18 File = string()
19 Options = [opt()]
20 opt() = db() | relaxed_row_name_assign_check() | deprecated()
21 | description() | reference() | group_check() | i() | il() |
22 imports() | module() | module_identity() | module_compli‐
23 ance() | agent_capabilities() | outdir() | no_defs() | ver‐
24 bosity() | warnings() | warnings_as_errors()
25 db() = {db, volatile|persistent|mnesia}
26 deprecated() = {deprecated, bool()}
27 relaxed_row_name_assign_check() =
28 relaxed_row_name_assign_check
29 description() = description
30 reference() = reference
31 group_check() = {group_check, bool()}
32 i() = {i, [dir()]}
33 il() = {il, [dir()]}
34 imports() = imports
35 module() = {module, atom()}
36 module_identity() = module_identity
37 module_compliance() = module_compliance
38 agent_capabilities() = agent_capabilities
39 no_defs() = no_defs
40 outdir() = {outdir, dir()}
41 verbosity() = {verbosity, silence|warn‐
42 ing|info|log|debug|trace}
43 warnings() = {warnings, bool()}
44 warnings_as_errors() = warnings_as_errors
45 dir() = string()
46 BinFileName = string()
47
48 Compiles the specified MIB file <File>.mib. The compiled file
49 BinFileName is called <File>.bin.
50
51 * The option db specifies which database should be used for
52 the default instrumentation.
53
54 Default is volatile.
55
56 * The option deprecated specifies if a deprecated definition
57 should be kept or not. If the option is false the MIB com‐
58 piler will ignore all deprecated definitions.
59
60 Default is true.
61
62 * The option relaxed_row_name_assign_check, if present, speci‐
63 fies that the row name assign check shall not be done
64 strictly according to the SMI (which allows only the value
65 1). With this option, all values greater than zero is
66 allowed (>= 1). This means that the error will be converted
67 to a warning.
68
69 By default it is not included, but if this option is present
70 it will be.
71
72 * The option description specifies if the text of the DESCRIP‐
73 TION field will be included or not.
74
75 By default it is not included, but if this option is present
76 it will be.
77
78 * The option reference specifies if the text of the REFERENCE
79 field, when found in a table definition, will be included or
80 not.
81
82 By default it is not included, but if this option is present
83 it will be. The reference text will be placed in the allo‐
84 cList field of the mib-entry record (#me{}) for the table.
85
86 * The option group_check specifies whether the mib compiler
87 should check the OBJECT-GROUP macro and the NOTIFICATION-
88 GROUP macro for correctness or not.
89
90 Default is true.
91
92 * The option i specifies the path to search for imported (com‐
93 piled) MIB files. The directories should be strings with a
94 trailing directory delimiter.
95
96 Default is ["./"].
97
98 * The option il (include_lib) also specifies a list of direc‐
99 tories to search for imported MIBs. It assumes that the
100 first element in the directory name corresponds to an OTP
101 application. The compiler will find the current installed
102 version. For example, the value ["snmp/mibs/"] will be
103 replaced by ["snmp-3.1.1/mibs/"] (or what the current ver‐
104 sion may be in the system). The current directory and the
105 <snmp-home>/priv/mibs/ are always listed last in the include
106 path.
107
108 * The option imports, if present, specifies that the IMPORT
109 statement of the MIB shall be included in the compiled mib.
110
111 * The option module, if present, specifies the name of a mod‐
112 ule which implements all instrumentation functions for the
113 MIB.
114
115 The name of all instrumentation functions must be the same
116 as the corresponding managed object it implements.
117
118 * The option module_identity, if present, specifies that the
119 info part of the MODULE-IDENTITY statement of the MIB shall
120 be included in the compiled mib.
121
122 * The option module_compliance, if present, specifies that the
123 MODULE-COMPLIANCE statement of the MIB shall be included
124 (with a mib-entry record) in the compiled mib. The mib-entry
125 record of the module-compliance will contain reference and
126 module part(s) this info in the assocList field).
127
128 * The option agent_capabilities, if present, specifies that
129 the AGENT-CAPABILITIES statement of the MIB shall be
130 included (with a mib-entry record) in the compiled mib. The
131 mib-entry record of the agent-capabilitie will contain ref‐
132 erence and modules part(s) this info in the assocList
133 field).
134
135 * The option no_defs, if present, specifies that if a managed
136 object does not have an instrumentation function, the
137 default instrumentation function should NOT be used, instead
138 this is reported as an error, and the compilation aborts.
139
140 * The option verbosity specifies the verbosity of the SNMP mib
141 compiler. I.e. if warning, info, log, debug and trace mes‐
142 sages shall be shown.
143
144 Default is silence.
145
146 Note that if the option warnings is true and the option ver‐
147 bosity is silence, warning messages will still be shown.
148
149 * The option warnings specifies whether warning messages
150 should be shown.
151
152 Default is true.
153
154 * The option warnings_as_errors, if present, specifies whether
155 warnings should be treated as errors.
156
157 The MIB compiler understands both SMIv1 and SMIv2 MIBs. It uses
158 the MODULE-IDENTITY statement to determine if the MIB is version
159 1 or 2.
160
161 The MIB compiler can be invoked from the OS command line by
162 using the command erlc. erlc recognizes the extension .mib, and
163 invokes the SNMP MIB compiler for files with that extension. The
164 options db, group_check, deprecated, description, verbosity,
165 imports and module_identity have to be specified to erlc using
166 the syntax +term. See erlc(1) for details.
167
168 is_consistent(Mibs) -> ok | {error, Reason}
169
170 Types:
171
172 Mibs = [MibName]
173 MibName = string()
174
175 Checks for multiple usage of object identifiers and traps
176 between MIBs.
177
178 mib_to_hrl(MibName) -> ok | {error, Reason}
179
180 Types:
181
182 MibName = string()
183
184 Generates a .hrl file with definitions of Erlang constants for
185 the objects in the MIB. The .hrl file is called <MibName>.hrl.
186 The MIB must be compiled, and present in the current directory.
187
188 The mib_to_hrl generator can be invoked from the OS command line
189 by using the command erlc. erlc recognizes the extension .bin,
190 and invokes this function for files with that extension.
191
193 erlc(1)
194
195
196
197Ericsson AB snmp 5.2.12 snmpc(3)