snmpc(3erl)
π snmpc π
okay bestie, welcome to snmpc β the Erlang module definition page for the interface functions to the SNMP toolkit MIB compiler. Manual name folded in right here, no boring header copy, we're slaying. π
πΈ NAME πΈ
snmpc β Interface Functions to the SNMP toolkit MIB compiler.
π DESCRIPTION π
The module snmpc contains interface functions to the SNMP toolkit MIB compiler. That's the description, but stay for the options, because they're lowkey iconic. β¨
β¨ EXPORTS β¨
π οΈ compile(File)
The one-arg signature is listed as compile(File) β that's the line, bestie. The two-arg version below is where the details live. π«Ά
π οΈ compile(File, Options) -> {ok, BinFileName} | {error, Reason}
Types:
File = string()
Options = [opt()]
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()
db() = {db, volatile|persistent|mnesia}
deprecated() = {deprecated, bool()}
relaxed_row_name_assign_check() =
relaxed_row_name_assign_check
description() = description
reference() = reference
group_check() = {group_check, bool()}
i() = {i, [dir()]}
il() = {il, [dir()]}
imports() = imports
module() = {module, atom()}
module_identity() = module_identity
module_compliance() = module_compliance
agent_capabilities() = agent_capabilities
no_defs() = no_defs
outdir() = {outdir, dir()}
verbosity() = {verbosity,
silence|warning|info|log|debug|trace}
warnings() = {warnings, bool()}
warnings_as_errors() = warnings_as_errors
dir() = string()
BinFileName = string()
Compiles the specified MIB file <File>.mib. The compiled file BinFileName is called <File>.bin. β¨
dbβ picks the database used for the default instrumentation.db() = {db, volatile|persistent|mnesia}. Default isvolatile.deprecatedβdeprecated() = {deprecated, bool()}. Says whether a deprecated definition should be kept or not. If the option isfalse, the MIB compiler will ignore all deprecated definitions. Default istrue.relaxed_row_name_assign_checkβrelaxed_row_name_assign_check() = relaxed_row_name_assign_check. If present, specifies that the row name assign check shall not be done strictly according to the SMI (which allows only the value1). With this option, all values greater than zero are allowed (>= 1). This means the error will be converted to a warning. By default it is not included, but if this option is present it will be. π¦descriptionβdescription() = description. Specifies if the text of theDESCRIPTIONfield will be included or not. By default it is not included, but if this option is present it will be.referenceβreference() = reference. Specifies if the text of theREFERENCEfield, when found in a table definition, will be included or not. By default it is not included, but if this option is present it will be. The reference text will be placed in theallocListfield of the mib-entry record (#me{}) for the table.group_checkβgroup_check() = {group_check, bool()}. Specifies whether the mib compiler should check theOBJECT-GROUPmacro and theNOTIFICATION-GROUPmacro for correctness or not. Default istrue.iβi() = {i, [dir()]}. Specifies the path to search for imported (compiled) MIB files. The directories should be strings with a trailing directory delimiter. Default is["./"].ilβil() = {il, [dir()]}. This is the include_lib option: it 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<snmp-home>/priv/mibs/are always listed last in the include path.importsβimports() = imports. If present, specifies that theIMPORTstatement of the MIB shall be included in the compiled mib.moduleβmodule() = {module, atom()}. If present, specifies the name of a module which implements all instrumentation functions for the MIB. The name of all instrumentation functions must be the same as the corresponding managed object it implements.module_identityβmodule_identity() = module_identity. If present, specifies that the info part of theMODULE-IDENTITYstatement of the MIB shall be included in the compiled mib.module_complianceβmodule_compliance() = module_compliance. If present, specifies that theMODULE-COMPLIANCEstatement of the MIB shall be included (with a mib-entry record) in the compiled mib. The mib-entry record of the module-compliance will containreferenceandmodulepart(s) β this info in theassocListfield).agent_capabilitiesβagent_capabilities() = agent_capabilities. If present, specifies that theAGENT-CAPABILITIESstatement of the MIB shall be included (with a mib-entry record) in the compiled mib. The mib-entry record of the agent-capabilitie will containreferenceandmodulespart(s) β this info in theassocListfield).no_defsβno_defs() = no_defs. 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.verbosityβverbosity() = {verbosity, silence|warning|info|log|debug|trace}. Specifies the verbosity of the SNMP mib compiler. I.e. if warning, info, log, debug and trace messages shall be shown. Default issilence. Note that if the optionwarningsistrueand the optionverbosityissilence, warning messages will still be shown.warningsβwarnings() = {warnings, bool()}. Specifies whether warning messages should be shown. Default istrue.warnings_as_errorsβwarnings_as_errors() = warnings_as_errors. If present, specifies whether warnings should be treated as errors.
tiny note: outdir() is in the type block above, and the original option bullets don't give it its own description, so we're not making one up. iykyk π«Ά
The MIB compiler understands both SMIv1 and SMIv2 MIBs. It uses the MODULE-IDENTITY statement to determine if the MIB is version 1 or 2.
The MIB compiler can be invoked from the OS command line by using the command erlc. erlc recognizes the extension .mib, and invokes the SNMP MIB compiler for files with that extension. The options db, group_check, deprecated, description, verbosity, imports and module_identity have to be specified to erlc using the syntax +term. See erlc(1) for details.
π§ is_consistent(Mibs) -> ok | {error, Reason}
Types:
Mibs = [MibName]
MibName = string()
Checks for multiple usage of object identifiers and traps between MIBs. π
π§ mib_to_hrl(MibName) -> ok | {error, Reason}
Types:
MibName = string()
Generates a .hrl file with definitions of Erlang constants for the objects in the MIB. The .hrl file is called <MibName>.hrl. The MIB must be compiled, and present in the current directory.
The mib_to_hrl generator can be invoked from the OS command line by using the command erlc. erlc recognizes the extension .bin, and invokes this function for files with that extension.
π SEE ALSO π
erlc(1)β yes bestie, that's the see-also, go read it. π
okay that's the whole snmpc(3erl) manual page, and the cute little footer energy is: Ericsson AB, version snmp 5.13.5, page snmpc(3erl) β no extra date printed on the line, so I'm not inventing one, periodt. π
β¨
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms