MIBs for SNMP Traps and Gets

Overview Copied

SNMP Get requests (or polling) and SNMP Traps communicate data using numeric OIDs (Object IDentifiers). The OIDs are translated from numbers into textual strings and back into numbers using MIBs (Management Information Bases). In Opsview, MIBs are used in the following ways:

Manufacturers have to conform to a set of standards for OIDs to work correctly - as a result, common SNMP OIDs should be translated on your Opsview Collector without any extra configuration.

However, many SNMP capable devices have specific attributes that are unique to them and as such may need additional MIBs installed on the Opsview Monitor systems to be able to translate the OIDs.

Some of these additional MIBs may be available through your normal package repository (for example, for Debian and Ubuntu) on each Opsview Monitor server. Other MIBs will need to be obtained from your device manufacturer and installed onto each of the Opsview Monitor servers.

In order to add MIBs to Opsview, you need to first know what the MIB will be used for:

For the ​translation of incoming traps on trap collectors, place your MIB in one of the appropriate directories on all servers responsible for monitoring the traps (including the master server). The directories for this purpose are:

For translation on the master, place your MIB in the appropriate directory for your distribution:

On the master you can define a custom location for your MIBs, to do so place the MIB files into a directory e.g. /opt/opsview/var/snmp and amend your custom SNMP config file (if it does not exist, create one under /etc/snmp/snmpd.conf.d) to include lines similar to:

mibdirs +/opt/opsview/snmptraps/var/load:/opt/opsview/var/snmp
mibs +ALL

This will naturally add the directory to the MIB search path that your command-line SNMP utilities use. You could also add the path to your trap MIBs in /opt/opsview/snmptraps/var/load in order to test sending those traps from the command-line

Note

Restart snmpd.

After making any changes to your SNMP config or adding new MIBs, restart snmpd so the changes are loaded: systemctl restart snmpd

You can see which directories are currently used on your Opsview Monitor system by using a command similar to

snmpget -v2c -D get_mib_directory -c <community string> <hostname> SNMPv2-MIB::sysDescr.0

Testing Traps Copied

To test snmp v2 traps:-

For a given host monitored by your orchestrator, assign host template ‘SNMP - Accept Traps’. This will add a service check to your host called ‘SNMP Trap - Alert on any trap’.

From the orchestrator run the following command (substitute <host/ip>):

snmptrap -v 2c -c public <host/ip> "" SNMPv2-MIB::coldStart sysContact.0 s "Hello World"

The service check ‘SNMP Trap - Alert on any trap’ should of now gone into a WARNING state with a similar message to

WARNING SNMPv2-MIB::coldStart trap received, contents: DISMAN-EXPRESSION-MIB::sysUpTimeInstance=2:5:57:14.39 RFC1213-MIB::sysContact="Hello World" SNMPv2-MIB::snmpTrapOID=SNMPv2-MIB::coldStart'

If this has not happened then from within the Opsview UI check out the SNMP Traps section under the Configuration menu, it may have gone here.

["Opsview On-premises"] ["Troubleshooting", "User Guide"]

Was this topic helpful?