How to monitor Layer-2 interface status using SNMP

Devices with support for the SNMP MIB-2 IfTable give you the possibility to monitor the Layer-2 link status of an interface. With the SnmpPoller, you can poll the interface status through an SNMP agent and the daemon can create alarms if the link status is not in the state you wanted to be.

:biohazard: I noticed the daemon name is a little bit misleading, something like SNMP Interface Poller would be a better choice, cause it is very specific to this use case.

The SnmpPoller can create four events to show the Operational and Administration status of the interface:

  • Event for Operational Status Up
  • Event for Operational Status Down
  • Event for Administration Status Up
  • Event for Administration Status Down

It is possible to create rules to select specific interfaces that you want to poll in the configuration file.


  • Device must support SNMP MIB-2 especially the following OIDS:
    • - ifAdminStatus, up(1), down(2), testing(3)
    • - ifOperStatus, up(1), down(2), testing(3)
  • Devices are provisionined in OpenNMS and are accessible via SNMP


  • Enable the daemon to allow SNMP interface monitoring
  • Start monitoring all ethernet type SNMP interfaces

Enable SNMP Interface Monitoring

Step 1: Enable the SnmpPoller in the ${OPENNMS_HOME}/etc/service-configuration.xml by changing service enabled to true

<service enabled="true">
  <invoke method="init" pass="0" at="start"/>
  <invoke method="start" pass="1" at="start"/>
  <invoke method="status" pass="0" at="status"/>
  <invoke method="stop" pass="0" at="stop"/>

Step 2: Customize the example1 package in ${OPENNMS_HOME}/etc/snmp-interface-poller-configuration.xml

<package name="example1">
  <filter>IPADDR != ''</filter>
  <include-range begin="" end=""/>
  <include-range begin="::1" end="::1"/>
  <interface criteria="snmpiftype = 6" name="Ethernet" interval="300000" user-defined="false" status="on"/>

The default setting just filter for devices with the SNMP management IP address In the example above we enable it for all devices. The interface criteria allows you to apply additional filters based on the information provided by the SNMP IF-Table

Step 3: Restart OpenNMS to start the SnmpPoller and apply the configuration

Using Provisioning Policies

If you want to decide which interfaces needs to be tested by the SnmpPoller you can create a MatchSnmpInterfacePolicy which sets the action ENABLE_POLLING. This will automatically enable this interface for beeing tested by the SnmpPoller.

Here’s an example to enable the interface monitoring for all ethernet type (page 17) interfaces in a requisition policy:

<policy name="SnmpInterfacePoller" class="org.opennms.netmgt.provision.persist.policies.MatchingSnmpInterfacePolicy">
  <parameter key="action" value="ENABLE_POLLING"/>
  <parameter key="matchBehavior" value="ALL_PARAMETERS"/>
  <parameter key="ifType" value="6"/>
1 Like


Is it possible to filter away devices which are put int a surveillance group?


   <package name="example1">
      <filter>(categoryName != 'TestGroup')</filter>
      <include-range begin="" end=""/>
      <interface criteria="snmpiftype = 6" name="Ethernet" interval="60000" user-defined="false" status="on"/>

I keep getting alarms in OpenNMS for devices which are put in the “TestGroup” category.

This is my Requisition SNMP Pattern Matching code

  <policy name="Interface Polling" class="org.opennms.netmgt.provision.persist.policies.MatchingSnmpInterfacePolicy">
     <parameter key="ifAdminStatus" value="~^(1|Up|up)$"/>
     <parameter key="action" value="ENABLE_POLLING"/>
     <parameter key="matchBehavior" value="ALL_PARAMETERS"/>
     <parameter key="ifName" value="~^(Gi|Fa|Te).*$"/>


Found a workaround using script policies

import org.opennms.netmgt.model.OnmsSnmpInterface;

import org.opennms.netmgt.model.OnmsCategory;

import org.opennms.netmgt.snmpinterfacepoller.pollable.PollableSnmpInterface.SnmpMinimalPollInterface;

for (OnmsCategory category : node.getCategories()){

    if (category.getName().matches('TestGroup')){

        for(OnmsSnmpInterface iface : node.getSnmpInterfaces()){



        return node;  



for(OnmsSnmpInterface iface : node.getSnmpInterfaces()){

    if (iface.getIfAdminStatus().equals(SnmpMinimalPollInterface.IF_UP) && iface.getIfName().matches('^(Gi|Fa|Te).*$')){





return node;

And modifying my snmp-interface-poller configuration to not filter the group TestGroup

1 Like

hola buenas tardes a todos, necesito monitorear una aplicación en OpenNMS es posible hacerlo? alguien podría orientarme