3 MIB files

Introduction

MIB stands for the Management Information Base. MIB files allow to use textual representation of an OID (Object Identifier). It is possible to use raw OIDs when monitoring SNMP devices with Zabbix, but if you feel more comfortable using textual representation, you need to install MIB files.

For example,

  1. ifHCOutOctets

is textual representation of the OID

  1. 1.3.6.1.2.1.31.1.1.1.10

Installing MIB files

On Debian-based systems:

  1. # apt install snmp-mibs-downloader
  2. # download-mibs

On RedHat-based systems:

  1. # dnf install net-snmp-libs

Enabling MIB files

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

  1. # As the snmp packages come without MIB files due to license reasons, loading
  2. # of MIBs is disabled by default. If you added the MIBs you can re-enable
  3. # loading them by commenting out the following line.
  4. #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:

  1. # apt install snmp

On RedHat-based systems:

  1. # dnf install net-snmp-utils

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

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

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.:

  1. # 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:

  1. # wget ftp://ftp.cisco.com/pub/mibs/v2/CISCO-SMI.my -P /tmp
  2. # mkdir -p /usr/local/share/snmp/mibs
  3. # 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
  4. # cp /tmp/CISCO-SMI.my /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:

  1. # snmptranslate -IR -On CISCO-SMI::ciscoProducts
  2. .1.3.6.1.4.1.9.1

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.