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:
- Translating the numeric OIDs into their textual form for easier reading in the Opsview web UI
- Translating the textual OIDs entered in the Opsview web UI into their numeric OID form for plugin execution without the need for MIBs on every executor
- Evaluating trap rules when a trap is received by a trap collector
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:
- If the MIB is to be used for translating incoming traps then it needs to exist on every trap collector
- If the MIB is to be used for any other purpose such as polling then it only needs to exist on just the master
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:
- custom location (see below)
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
/etc/snmp/snmp.conf file to include lines similar to:
mibdirs +/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
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
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 hasn't happened then from within the Opsview UI check out the SNMP Traps section under the Configuration menu, it may have gone here.
Updated over 2 years ago