snmpc(3)
β¨ snmpc π (Erlang Module Definition, bestie)
okay so this is the manual page for snmpc(3) in the Erlang docs, and it's literally the glue between you and the SNMP toolkit MIB compiler. no cap, it's iconic. let's get into it π
πΈ NAME πΈ
snmpc β interface functions to the SNMP toolkit MIB compiler. that's the whole vibe. it's the module that lets you talk to the MIB compiler from Erlang. periodt β¨
π¦ DESCRIPTION π¦
The module snmpc contains interface functions to the SNMP toolkit MIB compiler. that's it, that's the function. she's a connector, a liaison, a main character who introduces you to the compiler π
π«Ά See Also π«Ά
erlc(1)snmpc(command)β yes bestie, there's a whole other page for the command version, iykyk
π FUNCTIONS π
π compile(FileName, Options) -> {ok, BinFileName} | {error, Reason}
compile(FileName, Options) -> {ok, BinFileName} | {error, Reason}
when
FileName :: string(),
Options :: [Option],
Option ::
agent_capabilities |
{db, volatile | persistent | mnesia} |
{deprecated, boolean()} |
description |
{group_check, boolean()} |
{i, [snmp:dir()]} |
{il, [snmp:dir()]} |
imports |
{module, module()} |
module_identity | module_compliance | no_defs |
{outdir, snmp:dir()} |
reference | relaxed_row_name_assign_check |
{verbosity, snmp:verbosity()} |
{warnings, boolean()} |
{warnings_as_errors, boolean()},
BinFileName :: string(),
Reason :: term().
Compiles the MIB file you point at, <FileName>.mib. The compiled file that pops out, BinFileName, is called <FileName>.bin. cute, right? β¨
agent_capabilitiesβ if this option is present, it says theAGENT-CAPABILITIESstatement of the MIB shall be included (with amib-entryrecord) in the compiled mib. Themib-entryrecord of the agent-capabilities will containreferenceandmodulespart(s), this info in theassocListfield.{db, volatile | persistent | mnesia}β picks which database gets used for the default instrumentation. Default isvolatile. ngl,volatileis the default default π{deprecated, boolean()}β says whether a deprecated definition should be kept or not. If this option isfalse, the MIB compiler will ignore all deprecated definitions. Default istrue.descriptionβ says whether the text of theDESCRIPTIONfield gets included or not. By default it is not included, but if this option is present, it will be. she shows up when invited only π{group_check, boolean()}β whether the mib compiler should check theOBJECT-GROUPmacro and theNOTIFICATION-GROUPmacro for correctness or not. Default istrue.{i, [snmp:dir()]}β the path to search for imported (compiled) MIB files. The directories should be strings with a trailing directory delimiter. Default is["./"].{il, [snmp:dir()]}βil(short forinclude_lib, bestie) also gives a list of directories to search for imported MIBs. It assumes the first element in the directory name corresponds to an OTP application. The compiler will find the currently installed version. For example, the value["snmp/mibs/"]will be replaced by["snmp-3.1.1/mibs/"](or whatever the current version may be on your system). The current directory and<snmp-home>/priv/mibs/are always listed last in the include path. so they're the understudies at the end of the lineup πimportsβ if present, this says theIMPORTstatement of the MIB shall be included in the compiled mib.{module, module()}β if present, this names the 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. matchy matchy, we love consistency πmodule_identityβ if present, this says the info part of theMODULE-IDENTITYstatement of the MIB shall be included in the compiled mib.module_complianceβ if present, this says theMODULE-COMPLIANCEstatement of the MIB shall be included (with amib-entryrecord) in the compiled mib. Themib-entryrecord of the module-compliance will containreferenceandmodulepart(s), this info in theassocListfield.no_defsβ if present, this says 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. so dramatic, but valid πreferenceβ says whether 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 themib-entryrecord (#me{}) for the table.relaxed_row_name_assign_checkβ if present, this says 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.{verbosity, snmp:verbosity()}β picks the verbosity of the SNMP mib compiler. Like, whetherwarning,info,log,debugandtracemessages shall be shown. Default issilence. π€«
Note that if the optionwarningsistrueand the optionverbosityissilence, warning messages will still be shown. silence is not silence, bestie, that's the plot twist π
{warnings, boolean()}β says whether warning messages should be shown. Default istrue.{warnings_as_errors, boolean()}β if present, this says whether warnings should be treated as errors. no soft launches allowed π¨
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. she's bilingual, we stan a polyglot π
The MIB compiler can also be invoked from the OS command line with these two commands: erlc and snmpc.
π 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. π«Ά
π snmpc
snmpc is an escript that provides a more traditional interface to the MIB compiler.
See snmpc(command) for details.
π is_consistent(FileNames) -> ok | {error, Reason}
is_consistent(FileNames) -> ok | {error, Reason}
when
FileNames :: [MibName],
MibName :: string(),
Reason :: term().
Checks for multiple usage of object identifiers and traps between MIBs. she's the friend who notices when two people show up in the same outfit πβ¨
π§ mib_to_hrl(MibName) -> Result
mib_to_hrl(MibName) -> Result
when
MibName :: string(),
Result :: ok | {error, Reason},
Reason :: term().
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. no compiled MIB in the current dir? no hrl. rules are rules π
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.
and that's the whole page, bestie!! π
this manual page came to you from Ericsson AB, it's part of snmp 5.20.5, and it's the snmpc(3) page. stay compiled, stay consistent, and don't let your verbosity be anything but silence unless you mean it πβ¨π¦
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms