2022 Zabbix中国峰会
2022 Zabbix中国峰会

3 MIB files


MIB stands for a Management Information Base. MIB files allow you to use textual representation of the OID (Object Identifier).

For example,


is textual representation of OID

You can use either, when monitoring SNMP devices with Zabbix, but if you feel more comfortable when using textual representation you have to install MIB files.

Installing MIB files

On Debian-based systems:

# apt install snmp-mibs-downloader
       # download-mibs

On RedHat-based systems:

# yum install net-snmp-libs

Enabling MIB files

On RedHat-based systems the mib files should be enabled by default. On Debian-based systems you have to edit file /etc/snmp/snmp.conf and comment out the line that says mibs :

# As the snmp packages come without MIB files due to license reasons, loading
       # of MIBs is disabled by default. If you added the MIBs you can re-enable
       # loading them by commenting out the following line.
       #mibs :

Testing MIB files

Testing snmp MIBs can be done using snmpwalk utility. If you don't have it installed, use the following instructions.

On Debian-based systems:

# apt install snmp

On RedHat-based systems:

# yum install net-snmp-utils

After that, the following command must not give error when you query a network device:

$ snmpwalk -v 2c -c public <NETWORK DEVICE IP> ifInOctets
       IF-MIB::ifInOctets.1 = Counter32: 176137634
       IF-MIB::ifInOctets.2 = Counter32: 0
       IF-MIB::ifInOctets.3 = Counter32: 240375057
       IF-MIB::ifInOctets.4 = Counter32: 220893420

Used options:

-v 2c use SNMP protocol version 2c

Using MIBs in Zabbix

The most important to keep in mind is that Zabbix processes do not get informed of the changes made to MIB files. So after every change you must restart Zabbix server or proxy, e. g.:

# service zabbix-server restart

After that, the changes made to MIB files are in effect.

Using custom MIB files

There are standard MIB files coming with every GNU/Linux distribution. But some device vendors provide their own.

Let's say, you would like to use CISCO-SMI MIB file. The following instructions will download and install it:

# wget -P /tmp
       # mkdir -p /usr/local/share/snmp/mibs
       # grep -q '^mibdirs +/usr/local/share/snmp/mibs' /etc/snmp/snmp.conf 2>/dev/null || echo "mibdirs +/usr/local/share/snmp/mibs" >> /etc/snmp/snmp.conf
       # cp /tmp/ /usr/local/share/snmp/mibs

Now you should be able to use it. Try to translate the name of the object ciscoProducts from the MIB file to OID:

# snmptranslate -IR -On CISCO-SMI::ciscoProducts

If you receive errors instead of the OID, ensure all the previous commands did not return any errors.

The object name translation worked, you are ready to use custom MIB file. Note the MIB name prefix (CISCO-SMI::) used in the query. You will need this when using command-line tools as well as Zabbix.

Don't forget to restart Zabbix server/proxy before using this MIB file in Zabbix.

Keep in mind that MIB files can have dependencies. That is, one MIB may require another. In order to satisfy these dependencies you have to install all the affected MIB files.