aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/doc/src/snmpc.xml
blob: 8eb490d39112fc315f3df0b8b0d0d58abf2d6fb1 (plain) (blame)
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
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>2004</year><year>2013</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>snmpc</title>
    <prepared></prepared>
    <responsible></responsible>
    <docno></docno>
    <approved></approved>
    <checked></checked>
    <date></date>
    <rev></rev>
    <file>snmpc.xml</file>
  </header>
  <module>snmpc</module>
  <modulesummary>Interface Functions to the SNMP toolkit MIB compiler</modulesummary>
  <description>
    <p>The module <c>snmpc</c> contains interface functions to the 
      SNMP toolkit MIB compiler.</p>

    <marker id="compile"></marker>
  </description>

  <funcs>
    <func>
      <name>compile(File)</name>
      <name>compile(File, Options) -> {ok, BinFileName} | {error, Reason}</name>
      <fsummary>Compile the specified MIB</fsummary>
      <type>
        <v>File = string()</v>
        <v>Options = [opt()]</v>
        <v>opt() = db() | relaxed_row_name_assign_check() | deprecated() | 
	description() | reference() | group_check() |  i() | il() | 
	imports() | module() | module_identity() | module_compliance() | 
	agent_capabilities() | outdir() |  no_defs() | verbosity() | 
	warnings() | warnings_as_errors()</v>
        <v>db() = {db, volatile|persistent|mnesia}</v>
        <v>deprecated() = {deprecated, bool()}</v>
        <v>relaxed_row_name_assign_check() = relaxed_row_name_assign_check</v>
        <v>description() = description</v>
        <v>reference() = reference</v>
        <v>group_check() = {group_check, bool()}</v>
        <v>i() = {i, [dir()]}</v>
        <v>il() = {il, [dir()]}</v>
        <v>imports() = imports</v>
        <v>module() = {module, atom()}</v>
        <v>module_identity() = module_identity</v>
        <v>module_compliance() = module_compliance</v>
        <v>agent_capabilities() = agent_capabilities</v>
        <v>no_defs() = no_defs</v>
        <v>outdir() = {outdir, dir()}</v>
        <v>verbosity() = {verbosity, silence|warning|info|log|debug|trace}</v>
        <v>warnings() = {warnings, bool()}</v>
	<v>warnings_as_errors() = warnings_as_errors</v>
        <v>dir() = string()</v>
        <v>BinFileName = string()</v>
      </type>
      <desc>
        <marker id="compiler_opts"></marker>
        <p>Compiles the specified MIB file <c><![CDATA[<File>.mib]]></c>.  The
          compiled file <c>BinFileName</c> is called 
          <c><![CDATA[<File>.bin]]></c>. </p>
        <list type="bulleted">
          <item>
	    <p>The option <c>db</c> specifies which database should
	      be used for the default instrumentation. </p>
	    <p>Default is <c>volatile</c>. </p>
          </item>

          <item>
	    <p>The option <c>deprecated</c> specifies if a deprecated 
              definition should be kept or not. If the option is 
              false the MIB compiler will ignore all deprecated
              definitions. </p>
	    <p>Default is <c>true</c>. </p>
          </item>

          <item>
	    <p>The option <c>relaxed_row_name_assign_check</c>, if present,
	      specifies that the row name assign check shall not be done 
	      strictly according to the SMI (which allows only the value 1). 
              With this option, all values greater than zero is allowed 
	      (>= 1). This means that the error will be converted to a 
              warning. </p>
	    <p>By default it is not included, but if this option is present 
	      it will be. </p>
          </item>

          <item>
	    <p>The option <c>description</c> specifies if the text
              of the DESCRIPTION field will be included or not. </p>
	    <p>By default it is not included, but if this option is 
	      present it will be. </p>
          </item>

          <item>
	    <p>The option <c>reference</c> specifies if the text
              of the REFERENCE field, when found in a table definition, 
              will be included or not. </p>
	    <p>By default it is not included, but if this option is present 
	      it will be. The reference text will be placed in the allocList 
	      field of the mib-entry record (#me{}) for the table. </p>
          </item>

          <item>
	    <p>The option <c>group_check</c> specifies whether the
	      mib compiler should check the OBJECT-GROUP macro and
              the NOTIFICATION-GROUP macro for correctness or not.  </p>
	    <p>Default is <c>true</c>. </p>
          </item>

          <item>
	    <p>The option <c>i</c> specifies the path to search for
	      imported (compiled) MIB files. The directories should be
              strings with a trailing directory delimiter. </p>
	    <p>Default is <c>["./"]</c>. </p>
          </item>

          <item>
	    <p>The option <c>il</c> (include_lib) also specifies a
              list of directories to search for imported MIBs. It
              assumes that the first element in the directory name
              corresponds to an OTP application. The compiler will find
              the current installed version. For example, the value
              ["snmp/mibs/"] will be replaced by ["snmp-3.1.1/mibs/"]
              (or what the current version may be in the system). The
              current directory and the 
	      <c><![CDATA[<snmp-home>/priv/mibs/]]></c>
              are always listed last in the include path. </p>
          </item>

          <item>
	    <p>The option <c>imports</c>, if present, specifies that 
              the IMPORT statement of the MIB shall be included in the 
	      compiled mib. </p>
          </item>

          <item>
	    <p>The option <c>module</c>, if present, specifies the
              name of a module which implements all instrumentation
              functions for the MIB.  </p>
	    <p>The name of all instrumentation
              functions must be the same as the corresponding managed
              object it implements. </p>
          </item>

          <item>
	    <p>The option <c>module_identity</c>, if present, specifies 
              that the info part of the MODULE-IDENTITY statement of the MIB 
              shall be included in the compiled mib. </p>
          </item>

          <item>
	    <p>The option <c>module_compliance</c>, if present, specifies 
              that the MODULE-COMPLIANCE statement of the MIB shall be included 
              (with a mib-entry record) in the compiled mib. The mib-entry record 
	      of the module-compliance will contain <c>reference</c> and <c>module</c> 
	      part(s) this info in the <c>assocList</c> field). </p>
          </item>

          <item>
	    <p>The option <c>agent_capabilities</c>, if present, specifies 
              that the AGENT-CAPABILITIES statement of the MIB shall be included 
              (with a mib-entry record) in the compiled mib. The mib-entry record 
	      of the agent-capabilitie will contain <c>reference</c> and <c>modules</c> 
	      part(s) this info in the <c>assocList</c> field). </p>
          </item>

          <item>
	    <p>The option <c>no_defs</c>, if present, specifies 
              that if a managed object does not have an instrumentation
              function, the default instrumentation function should NOT
              be used, instead this is reported as an error, and the
              compilation aborts. </p>
          </item>

          <item>
	    <p>The option <c>verbosity</c> specifies the verbosity of
	      the SNMP mib compiler. I.e. if warning, info, log, debug 
              and trace messages shall be shown. </p>
	    <p>Default is <c>silence</c>. </p>
            <p>Note that if the option <c>warnings</c> is <c>true</c> and the 
              option <c>verbosity</c> is <c>silence</c>, warning messages will
              still be shown. </p>
          </item>

          <item>
	    <p>The option <c>warnings</c> specifies whether warning
	    messages should be shown. </p>
	    <p>Default is <c>true</c>. </p>
          </item>

	  <item>
	    <p>The option <c>warnings_as_errors</c>, if present, specifies 
	    whether warnings should be treated as errors.</p>
	  </item>

        </list>
	
        <p>The MIB compiler understands both SMIv1 and SMIv2 MIBs.  It
          uses the <c>MODULE-IDENTITY</c> statement to determine if the MIB is
          version 1 or 2.
          </p>
        <p>The MIB compiler can be invoked from the OS command line by
          using the command <c>erlc</c>.  <c>erlc</c> recognizes the
          extension <c>.mib</c>, and invokes the SNMP MIB compiler for
          files with that extension. The options <c>db</c>, 
          <c>group_check</c>, <c>deprecated</c>, <c>description</c>,
          <c>verbosity</c>, <c>imports</c> and <c>module_identity</c>
          have to be specified to <c>erlc</c> using the syntax 
          <c>+term</c>.  See <c>erlc(1)</c> for details.
          </p>

	  <marker id="is_consistent"></marker>
      </desc>
    </func>

    <func>
      <name>is_consistent(Mibs) -> ok | {error, Reason}</name>
      <fsummary>Check for OID conflicts between MIBs</fsummary>
      <type>
        <v>Mibs = [MibName]</v>
        <v>MibName = string()</v>
      </type>
      <desc>
        <p>Checks for multiple usage of object identifiers and traps
          between MIBs.
          </p>

	  <marker id="mib_to_hrl"></marker>
      </desc>
    </func>

    <func>
      <name>mib_to_hrl(MibName) -> ok | {error, Reason}</name>
      <fsummary>Generate constants for the objects in the MIB</fsummary>
      <type>
        <v>MibName = string()</v>
      </type>
      <desc>
        <p>Generates a <c>.hrl</c> file with definitions of Erlang
          constants for the objects in the MIB. The <c>.hrl</c> file is
          called <c><![CDATA[<MibName>.hrl]]></c>. The MIB must be compiled, and
          present in the current directory.
          </p>
        <p>The <c>mib_to_hrl</c> generator can be invoked from the OS
          command line by using the command <c>erlc</c>.  <c>erlc</c>
          recognizes the extension <c>.bin</c>, and invokes this function
          for files with that extension.
          </p>
      </desc>
    </func>
  </funcs>

  <section>
    <title>See Also</title>
    <p>erlc(1)
      </p>
  </section>
  
</erlref>