Ignoring Docker volumes and network interfaces


If your systems host Docker containers OpenNMS will collect per default performance data from all Docker volumes and interfaces, because the SNMP tables provide them.
Depending on the amount of containers and the fluctuation you will have a lot RRD files that will fill up your disks, collecting data that you don’t need and that will not be deleted after the interface or volume is not used anymore.

Solution approaches

Provisiond policies

It is possible to add a policy that avoids collecting data or ignores defined network interfaces. The policy has to be added in default-foreign-source.xml or in a corresponding foreign source definition of your need.

<policy name="ignore Docker interfaces" class="org.opennms.netmgt.provision.persist.policies.MatchingSnmpInterfacePolicy">
  <parameter key="action" value="DO_NOT_PERSIST"/>
  <parameter key="ifDescr" value="~^docker.*$"/>
  <parameter key="matchBehavior" value="ALL_PARAMETERS"/>

:information_source: This only works for new nodes. Existing ones will not drop the collections if you add the policy afterwards.

Data collection excludes

The MIB2 SNMP datacollection needs to use PersistRegexSelectorStrategy instead of PersistAllSelectorStrategy.


Switch from:

<persistenceSelectorStrategy class="org.opennms.netmgt.collection.support.PersistAllSelectorStrategy"/>


<persistenceSelectorStrategy class="org.opennms.netmgt.collectd.PersistRegexSelectorStrategy">
  <parameter key="match-expression" value="not(#hrStorageDescr matches '^\/var\/lib\/docker\/containers.*|.*\/run.*|.*dev\/shm$|.*cgroup$|.*docker\/aufs$')"/>


If you need the metrics for your Docker interfaces or volumes for some time and just want to clean up the RRD files regulary, you can use such a command and run it via cron.

It will delete all RRD files, that are not touched since 30 days.

find /opt/opennms/share/ -name "*.rrd" -type f -mtime +30 -exec rm -f {} \;

1 Like