INFO-level "unable to locate resource" log messages for interfaces not persisted by policy

Description

Steps to reproduce on a freshly installed system:

1) Set the collectd appender to DEBUG or INFO in log4j2.xml
2) Edit default foreign-source definition, adding a Match SNMP Interface policy with action = DO_NOT_PERSIST and parameters that will match one interface on a node to be added. For example, key: ifDescr / value: eth1.
3) Use snmpwalk or a similar utility to determine the ifIndex of the interface targeted by this policy. On the system I'm using, it's 4.
4) Add node to system

Expected result: No log messages about data collected for the unpersisted interface, maybe?

Actual result: Lots of INFO-level messages indicating unable to locate resource for the unpersisted interface (instance id 4):

2017-05-30 19:53:55,481 INFO [DefaultUDPTransportMapping_0.0.0.0/0] o.o.n.c.SnmpCollectionSet: Unable to locate resource for agent Agent[nodeid = 1 ipaddr= 192.168.33.1] with instance id 4 while collecting attribute ifSpeed [.1.3.6.1.2.1.2.2.1.5] 2017-05-30 19:53:55,482 INFO [DefaultUDPTransportMapping_0.0.0.0/0] o.o.n.c.SnmpCollectionSet: Unable to locate resource for agent Agent[nodeid = 1 ipaddr= 192.168.33.1] with instance id 4 while collecting attribute ifInOctets [.1.3.6.1.2.1.2.2.1.10] 2017-05-30 19:53:55,482 INFO [DefaultUDPTransportMapping_0.0.0.0/0] o.o.n.c.SnmpCollectionSet: Unable to locate resource for agent Agent[nodeid = 1 ipaddr= 192.168.33.1] with instance id 4 while collecting attribute ifInUcastpkts [.1.3.6.1.2.1.2.2.1.11] 2017-05-30 19:53:55,482 INFO [DefaultUDPTransportMapping_0.0.0.0/0] o.o.n.c.SnmpCollectionSet: Unable to locate resource for agent Agent[nodeid = 1 ipaddr= 192.168.33.1] with instance id 4 while collecting attribute ifInDiscards [.1.3.6.1.2.1.2.2.1.13]

TBH I'm not sure there's anything inappropriate about logging these messages, because there's no way Collectd could (or even should) be aware of interfaces whose existence Provisiond has disavowed at the user's direction. The design of the SNMP collector makes it impossible to avoid getting the disavowed interfaces' data from the agent. Maybe the "fix" is to special-case the log message for resources of type ifIndex, adding a note that this behavior may be completely expected if DO_NOT_PERSIST policies are in use.

Environment

https://mynms.opennms.com/Ticket/Display.html?id=5059 Any system with SNMP interface policies implementing DO_NOT_PERSIST behavior

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Jesse White November 2, 2017 at 7:08 PM

Seems like the easiest way to approach this. Merged to foundation-2016.

Jeff Gehlbach October 31, 2017 at 7:53 PM

Made a stab at it with this PR:

https://github.com/OpenNMS/opennms/pull/1736

Turns out instance / resource-type from the config is not available here, so using OID base prefix matching as a heuristic. If we're looking at the ifTable or ifXTable, log at DEBUG and make a note of the likely reason for the resource to be missing.

Fixed

Details

Assignee

Reporter

Labels

Affects versions

Priority

PagerDuty

Created May 30, 2017 at 4:16 PM
Updated November 2, 2017 at 7:08 PM
Resolved November 2, 2017 at 7:08 PM

Flag notifications