snmpc(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

✨ 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 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-capabilities will contain reference and modules part(s), this info in the assocList field.
  • {db, volatile | persistent | mnesia} β€” picks which database gets used for the default instrumentation. Default is volatile. ngl, volatile is the default default πŸ’€
  • {deprecated, boolean()} β€” says whether a deprecated definition should be kept or not. If this option is false, the MIB compiler will ignore all deprecated definitions. Default is true.
  • description β€” says whether the text of the DESCRIPTION field 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 the OBJECT-GROUP macro and the NOTIFICATION-GROUP macro for correctness or not. Default is true.
  • {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 for include_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 the IMPORT statement 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 the MODULE-IDENTITY statement of the MIB shall be included in the compiled mib.
  • module_compliance β€” if present, this says 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 reference and module part(s), this info in the assocList field.
  • 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 the REFERENCE field, 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 the allocList field of the mib-entry record (#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 value 1). 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, whether warning, info, log, debug and trace messages shall be shown. Default is silence. 🀫
Note that if the option warnings is true and the option verbosity is silence, 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 is true.
  • {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