While looking at monitoring a generator, I came across an interesting project.

https://github.com/cavaliercoder/mib2zabbix

tl;dr if you have a MIB for your device, you can convert it to a Zabbix template and use the Zabbix discovery tool to pull points from it.

It’s relatively easy to use, but it does have some prerequisites.

So this process will describe how to pull in a MIB and convert to a template using MIB Browser and bash.

Open your MIB in MIB Browser. What were are looking for is the OID at the top of our device tree.

That’s all we need from MIB browser.

The section below is fiddly, and possibly missing some steps. snmp is a bit of a strange one, so if it doesn’t work don’t be surprised, there’s probably additional bits I’ve forgotten about that you need to do

Now we’ll install some dependencies.

sudo apt install perl5 libxml-simple-perl libsnmp-perl snmp snmp-mibs-downloader

Copy your MIB into your MIBs directory, this is usually /usr/share/snmp/mibs

You will probably have to add a line to your /etc/snmp/snmp.conf file as well to include mibs +ALL at the bottom.

Next step is to clone mib2zabbix in a directory somewhere.

git clone https://github.com/cavaliercoder/mib2zabbix.git

Make it executable with chmod +x

I dropped the script in my ~/bin directory (I’m pretty sure the doco for mib2zabbix says the same thing), since this was already in my path. Otherwise, you can execute the script from your local directory, it’s just more annoying.

Now we just point the script at the OID from earlier.

mib2zabbix -o .1.3.6.1.4.1.41385.1.4 -f dse.xml -v 2

This will spit out a chunk of xml that you can import into Zabbix to use as a template.

Very, very handy! I think it’s great that Zabbix has templates (among other great features), and this can drastically reduce the time it takes to manually set up a bunch of SNMP points to pull in.