Convert MIBs Files to Zabbix Templates
MIB files can be analysed and converted to Zabbix templates containing Items, Discovery Rules and Value Types.
One script for doing this is called mib2zabbix and can be downloaded from https://github.com/cavaliercoder/mib2zabbix.
Before running this script, you should already have the required SNMP dependencies installed and configured correctly.
On Ubuntu and other Debian based systems,
1 2 3
On Centos and other Red-Hat based systems
1 2 3
Now configure the snmp.conf to return MIBs descriptions.
Comment out the
mibs line like this,
Do a simple test.
This is a MIB description of the OID 18.104.22.168.2.1.1
snmptranslate is now able to translate, and this is required before you can continue.
mib2zabbix.pl is written in perl, so you will need to install the perl dependencies.
On CentOS 8, you may get the error that the perl snmp libs cannot be found. You can download the rpm first from
rpm -ivh http://repo.okay.com.mx/centos/8/x86_64/release/okay-release-1-3.el8.noarch.rpm and then try again.
Next, get the mib2zabbix perl script
Give the mib2zabbix file execute permissions.
The response should be
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
If you get anything else then perl was not installed properly or it cannot find mib2zabbix. Check the error in the console.
Now to ensure you have the required MIB file that you want to convert.
A good example may be the HUAWEI-MIB.mib.
You can usually find the MIB files you need on the internet.
You can download the HUAWEI-MIB.mib from here.
Next, see if snmptranslate can read this file.
You should see this plus many more lines showing the MIBs and their OIDs,
1 2 3 4 5 6 7
Now it is time to convert it to a template for Zabbix by piping the snmptranslate response into mib2zabbix.
This will create a new file called template-huawei-mib.xml with the name huawei-mib within the xml.
1 2 3 4 5 6 7 8 9 10 11 12 13
This new xml file can be imported into Zabbix
See video for a more detailed demonstration and recommendations. Also note that all items, discovery rules and their item prototypes will be disabled by default. You should decide which is important to enable for your needs based on the devices official documentation. Enabling all items, discovery rules and their item prototypes may put unnecessary strain on your Zabbix server resources and the SNMP device so it is important to check what you actually need.