add_mibdir, netsnmp_init_mib, shutdown_mib, netsnmp_read_module, read_mib, read_all_mibs, add_module_replacement, snmp_set_mib_errors, snmp_set_mib_warnings, snmp_set_save_descriptions, read_objid, snmp_parse_oid, get_module_node, print_mib, print_objid, fprint_objid, snprint_objid, print_description, fprint_description, snprint_description - netsnmp_mib_api functions


#include <net−snmp/mib_api.h>

Initialisation and Shutdown
int add_mibdir(const char *

void netsnmp_init_mib(void);
void shutdown_mib(void);

Reading and Parsing MIBs
struct tree *netsnmp_read_module(const char *
struct tree *read_mib(const char *
struct tree *read_all_mibs(void);

int add_module_replacement(const char *old_module,
const char *
const char *
tag, int len);

void snmp_set_mib_warnings(int level);
void snmp_set_mib_errors(int
void snmp_set_save_descriptions(int

Searching the MIB Tree
int read_objid(const char *
oid *
objid, size_t *objidlen);
oid *snmp_parse_oid(const char *
oid *
objid, size_t *objidlen);
int get_module_node(const char *
name, const char *module,
oid *
objid, size_t *objidlen);

void print_mib(FILE *

void print_objid(const oid *objid, size_t objidlen);
void fprint_objid(FILE *
const oid *
objid, size_t objidlen);
int snprint_objid(char *
buf, size_t len,
const oid *
objid, size_t objidlen);

void print_description(const oid *objid, size_t objidlen, int width);
void fprint_description(FILE *
const oid *
objid, size_t objidlen, int width);
int snprint_description(char *
buf, size_t len,
const oid *
objid, size_t objidlen, int width);


The functions dealing with MIB modules fall into four groups - those dealing with initialisation and shutdown, with reading in and parsing MIB files, with searching the MIB tree, and output routines.

Initialisation and Shutdown
is used to add the specified directory to the path of locations which are searched for files containing MIB modules. Note that this does not actually load the MIB modules located in that directory, but is simply an initialisation step to make them available to netsnmp_read_module. This function returns a count of files found in the directory, or a −1 if there is an error. It should be called before invoking netsnmp_init_mib.

netsnmp_init_mib configures the MIB directory search path (using add_mibdir ), sets up the internal MIB framework, and then loads the appropriate MIB modules (using netsnmp_read_module and read_mib). See the ENVIRONMENTAL VARIABLES section for details.
It should be called before any other routine that manipulates or accesses the MIB tree (but after any additional add_mibdir calls).

shutdown_mib will clear the information that was gathered by netsnmp_read_module, add_mibdir and add_module_replacement. It is strongly recommended that one does not invoke shutdown_mib while there are SNMP sessions being actively managed.

Reading and Parsing MIBs
takes the name of a MIB module (which need not be the same as the name of the file that contains the module), locates this within the configured list of MIB directories, and loads the definitions from the module into the active MIB tree. It also loads any MIB modules listed in the IMPORTS clause of this module.

read_mib is similar, but takes the name of the file containing the MIB module. Note that this file need not be located within the MIB directory search list (although any modules listed in the IMPORTS clause do).

read_all_mibs will read in all the MIB modules found on the MIB directory search list.

In general the parser is silent about what strangenesses it sees in the MIB files. To get warnings reported, call snmp_set_mib_warnings with a level of 1 (or 2 for even more warnings).

add_module_replacement can be used to allow new MIB modules to obsolete older ones, without needing to amend the IMPORTS clauses of other modules. It takes the names of the old and new modules, together with an indication of which portions of the old module are affected.

It can also be used to handle errors in the module identifiers used in MIB IMPORTS clauses (such as referring to RFC1213 instead of RFC1213−MIB).

Searching the MIB Tree
takes a string containing a textual version of an object identifier (in either numeric or descriptor form), and transforms this into the corresponding list of sub-identifiers. This is returned in the output parameter, with the number of sub-identifiers returned via out_len. When called, out_len must hold the maximum length of the output array. If multiple object identifiers are being processed, then this length should be reset before each call. This function returns a value of 1 if it succeeds in parsing the string and 0 otherwise.

snmp_parse_oid is similar, but returns a pointer to the parsed OID buffer (or NULL).

get_module_node takes a descriptor and the name of a module, and returns the corresponding oid list, in the same way as read_objid above.
If the module name is specified as "ANY", then this routine will assume that the descriptor given is unique within the tree, and will return the matching entry. If this assumption is invalid, then the behaviour as to which variable is returned is implementation dependent.

will print out a representation of the currently active MIB tree to the specified FILE pointer.

print_objid will take an object identifier (as returned by read_objid, snmp_parse_oid or get_module_node), and prints the textual form of this OID to the standard output.

fprint_objid does the same, but prints to the FILE pointer specified by the initial parameter.

snprint_objid prints the same information into the buffer pointed to by buf which is of length len. It returns the number of characters printed, or −1 if the buffer was not large enough. In the latter case, buf will typically contain a truncated version of the information (but this behaviour is not guaranteed).

print_description, fprint_description, and snprint_description take a similar object identifier and print out a version of the MIB definition for that object, together with the full OID. The width argument controls how the OID is layed out.

By default the parser does not save descriptions since they may be huge. In order to be able to print them, it is necessary to invoke snmp_set_save_descriptions(1)before calling init_mib (or similar).


The main use of environmental variables with respect to these API calls is to configure which MIB modules should be loaded, and where they are located.


A colon separated list of directories to search for MIB modules.

Default: /usr/share/snmp/mibs
Used by init_mib, netsnmp_read_module, read_all_mibs and (implicitly) by read_mib.


A colon separated list of MIB modules to load.

The default list of modules will depend on how the Net-SNMP software was originally compiled, but is typically: IP−MIB:IF−MIB:TCP−MIB:UDP−MIB:SNMPv2−MIB:RFC1213−MIB: UCD−SNMP−MIB:HOST−RESOURCES−MIB

If the value of the MIBS environmental variable starts with a ’+’ character, then these MIB modules will be added to the default list. Otherwise these modules (plus any that they IMPORT from) will be loaded instead of the default list.

If the MIBS environmental variable has the value ALL then read_all_mibs will be called to load the full collection of all available MIB modules.

Used by init_mib only.


A colon separated list of files to load.

Default: (none)
Used by init_mib only.


snmp_api(3), output_api(3)

More Linux Commands

XRecolorCursor(3) - manipulate cursors - Linux manual page
The XRecolorCursor function changes the color of the specified cursor, and if the cursor is being displayed on a screen, the change is visible immediately. The

vfs_cap(8) - CAP encode filenames - Linux manual page.......
This VFS module is part of the samba(7) suite. CAP (Columbia Appletalk Protocol) encoding is a technique for representing non-ASCII filenames in ASCII. The vfs_

glDrawRangeElements(3gl) - render primitives from array data
glDrawRangeElements is a restricted form of glDrawElements. mode, start, end, and count match the corresponding arguments to glDrawElements, with the additional

glPixelZoom(3gl) - specify the pixel zoom factors (ManPage)
glPixelZoom specifies values for the $x$ and $y$ zoom factors. During the execution of glDrawPixels or glCopyPixels, if ($xr $, $yr $) is the current raster pos

ntfs-3g.probe(8) - Probe an NTFS volume mountability........
The ntfs-3g.probe utility tests a volume if its NTFS mountable read-only or read-write, and exits with a status value accordingly. The volume can be a block dev

clnt_perror(3) - library routines for remote procedure calls
These routines allow C programs to make procedure calls on other machines across the network. First, the client calls a procedure to send a data packet to the s

enscript(1) - convert text files to PostScript, HTML, RTF, A
Enscript converts text files to PostScript or to other output languages. Enscript can spool the generated output directly to a specified printer or leave it to

libtool(1) - manual page for libtool 2.4 - Linux man page...
Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display comm

glutSolidDodecahedron(3) - render a solid or wireframe dodec
glutSolidDodecahedron and glutWireDodecahedron render a solid or wireframe dodecahedron respectively centered at the modeling coordinates origin with a radius o

gnutls_x509_crq_get_extension_info(3) - API function........
gnutls_x509_crq_get_extension_info.3 - This function will return the requested extension OID in the certificate, and the critical flag for it. The extension OID

ldap_start_tls(3) - LDAP TLS initialization routines........
These routines are used to initiate TLS processing on an LDAP session. ldap_start_tls_s() sends a StartTLS request to a server, waits for the reply, and then in

btrfs-debug-tree(8) dump btrfs filesystem metadata into stdo
btrfs-debug-tree is used to dump the whole tree of the given device. This is maybe useful for analyzing filesystem state or inconsistence and has a positive edu

We can't live, work or learn in freedom unless the software we use is free.