Solaris System Management Agent Developer's Guide

Setting MIB Environment Variables

You should set the MIBS and MIBDIRS environment variables to ensure that the tools that use the MIBs can find and load your MIB file. Tools that use the MIBs include mib2c and all the snmp commands such as snmpget, snmpwalk, and snmpset.

Set the MIBS environment variable to include the MIB file that you are using. For example, to add a MIB called MYTESTMIB.txt to the list of MIBs, use one of the following commands:

In the csh or tcsh shells:


% setenv MIBS +MYTESTMIB

In the sh or bash shells:


# MIBS=+MYTESTMIB;export MIBS

These commands add your MIB to the list of default MIB modules that the agent supports.

The default search path for MIB files is /etc/sma/snmp/mibs. You can modify the MIB search path by setting the MIBDIRS variable. For example, to add the path /home/mydir/mibs to the MIB search path, type the following commands:

In the csh or tcsh shells:


% setenv MIBDIRS /home/mydir/mibs:/etc/sma/snmp/mibs
% setenv MIBS ALL

In the sh or bash shells:


# MIBDIRS=/home/mydir/mibs:/etc/sma/snmp/mibs
# export MIBDIRS
# MIBS=ALL;export MIBS

Setting MIBS to ALL ensures that mib2c finds all MIBs in the search location for MIB files. Both the MIB files to be loaded and the MIB file search location can also be configured in the snmp.conf file. See the snmp.conf(4)man page for more information.


Note –

You should avoid copying your MIBs into the /etc/sma/snmp/mibs directory. That directory should be reserved for the MIBs provided with SMA.