SNMP detector: vbvalue field does not handle regex match

Description

The detector should check the OID value and if it matches one of those two possibilities, it should add the service on an interface.
But it does not work.

<detector name="DNS-Resolution-v4" class="org.opennms.netmgt.provision.detector.snmp.SnmpDetector"> <parameter key="ipMatch" value="10.10.*.* || 172.21-22.*.* "/> <parameter key="oid" value=".1.3.6.1.2.1.1.2.0"/> <parameter key="matchType" value="ANY"/> <parameter key="vbvalue" value="~.*(311\.1\.1\.3\.1\..*|8072\.3\.2\.10)"/> <parameter key="serviceName" value="DNS-Resolution-v4"/> </detector>

This is the corresponding log entry:

2019-10-08 13:54:08,323 DEBUG [scanExecutor-15] o.o.n.p.d.s.SnmpDetector: SNMP: services detected false using matchType=Any, expectedValue=~.*(311\.1\.1\.3\.1\.2|8072\.3\.2\.10), retrievedValues=[.1.3.6.1.4.1.8072.3.2.10]

I've also tried

<parameter key="vbvalue" value="~\.1\.3\.6\.1\.4\.1\.8072\.3\.2\.10|\.1\.3\.6\.1\.4\.1\.311\.1\.1\.3\.1.*"/>

without success.

I've verified both version of the regexes on https://regexr.com/.

Those OIDs can be used to check the regex.

.1.3.6.1.4.1.8072.3.2.10 .1.3.6.1.4.1.311.1.1.3.1.2 .1.3.6.1.4.1.311.1.1.3.1.3

When I just use one OID without regex match it works fine:

<detector name="DNS-Resolution-v4" class="org.opennms.netmgt.provision.detector.snmp.SnmpDetector"> <parameter key="ipMatch" value="10.10.*.* || 172.21-22.*.* "/> <parameter key="oid" value=".1.3.6.1.2.1.1.2.0"/> <parameter key="matchType" value="ANY"/> <parameter key="vbvalue" value=".1.3.6.1.4.1.8072.3.2.10"/> <parameter key="serviceName" value="DNS-Resolution-v4"/> </detector>

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Christian Pape November 20, 2019 at 7:42 AM

Currently the detector queries for a OID to decide if a service should be bound to the interface. In order to use a regex we have to walk the entire SNMP tree and check the regex against it. For slow or also large devices this can take a lot of time even minutes. I don't think that's a good idea.

Details

Assignee

Reporter

HB Grooming Date

HB Backlog Status

Affects versions

Priority

PagerDuty

Created October 8, 2019 at 1:48 PM
Updated November 8, 2021 at 4:18 PM