How to add a new SNMP MIB file to OpenNMS

User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active


You are using SNMP to expose information about your services and you are using OpenNMS to monitor everything. Then you have some SNMP data that is not supported out of the box on OpenNMS. This page describes how you can add data collection and graphs for more SNMP data, assuming you have the MIB file for the SNMP data.

This example is for the "mod_statistics" Apache module, which exposes Apache statistics using SNMP and has a MIB file, but it should be helpful for all cases where you have a MIB file which has no default support in OpenNMS.

So now you have the NetSNMP daemon exposing Apache statistcs or another SNMP process exposing the data corresponding to your MIB file, and you want OpenNMS to collect and graph the data.

Import the APACHE2-MIB in OpenNMS

Open the OpenNMS GUI  and log in:

  • Go to the Admin->SNMP MIB Compiler page.
  • Click the Upload MIB, and select the modified APACHE2-MIB file
  • The MIB file appears under "Pending"
  • Select the file, right click and select "Compile MIB"
  • The MIB file now appears under "Compiled"
  • Select the file, right click and select "Generate Data Collection"
  • Leave things as is, and click the "Save Data Collection File"
  • Select the file, right click and select "Generate Events", if you walso want to receive SNMP traps

Edit the datacollection/APACHE2-MIB.xml

Edit the file /etc/opennms/datacollection/APACHE2-MIB.xml, you need to add the following at the end of the file if it is NetSNMP that is exposing your data :

<systemDef name="Apache Web Server - Net-SNMP">

This is needed so that OpenNMS will actually ask the nodes for the SNMP OIDs, and store the data.

This can also be done using GUI : Admin -> Manage SNMP Collections and Data Collection Groups -> System Definitions.

I had originally used "<sysoidMask>.</sysoidMask>", since that is the "parent OIDs" for the APACHE-MIB file, but that was wrong. It has to be a sysoidMask matching the one for Net-SNMP.

If there is a separate SNMP process exposing the data for the MIB file, you should use a sysoidMask that matches the common parent OID in the MIB file.


Afterwards, you have to edit the "/etc/opennms/datacollection-config.xml" file, adding a line like :

<include-collection dataCollectionGroup="APACHE2-MIB"/>


Check that data is being generated by OpenNMS

Have a look at the /var/lib/opennms/rrd/snmp/<nodeid>/, for example /var/lib/opennms/rrd/snmp/8/ directory, and check that you see files like :



Configuring graphs

OpenNMS will generate default graphs for you, but you probably want to customize these. You can see examples of such customization at OpenNMS graphs for Apache HTTP server.

Additional information