Large values of snmpifspeed come out negative when used in resource-filter

Description

Created from support ticket https://mynms.opennms.com/Ticket/Display.html?id=3217

Sanitized details from that ticket:

<threshold description="ifInErrors auf Backbone-Port" type="high" ds-type="if" value="0.0001" rearm="0.0" trigger="1" ds-label="ifName" triggeredUEI="uei.example.org/threshold/BackboneIfInErrorsExceeded" rearmedUEI="uei.example.org/threshold/BackboneIfInErrorsRearmed" filterOperator="or" ds-name="ifInErrors"> <resource-filter field="snmpifspeed">^[1-9]+[0-9]{10,12}$</resource-filter> </threshold>

Up to something less than 10 GBit/s it seems to be working using
<resource-filter field="snmpifspeed">^[1-9]+[0-9]{0,9}$</resource-filter>
but maybe we miss some interfaces, see explanation below.

We turned DEBUG level loging on for collectd. From collectd:

fgrep "value of snmpifspeed is" collectd.log* | cut -d: -f6 | sed -e"s/ the value of snmpifspeed is //" | sort -u

so we see "the value of snmpifspeed is":

0. Pass filter? false
1000000000. Pass filter? false
1000000000. Pass filter? true
100000000. Pass filter? false
100000000. Pass filter? true
10000000. Pass filter? false
10000000. Pass filter? true
-1294967296. Pass filter? false
1345294336. Pass filter? false
1345294336. Pass filter? true
1410065408. Pass filter? false
1410065408. Pass filter? true
-1474836480. Pass filter? false
1705032704. Pass filter? false
1705032704. Pass filter? true
2000000000. Pass filter? false
2000000000. Pass filter? true
23000. Pass filter? false
23000. Pass filter? true
-294967296. Pass filter? false
-589934592. Pass filter? False

But no negavite values appear in snmpinterface.snmpifspeed in the database.

Environment

Any system with 10Gbps interfaces represented in the snmpinterface table and thresholds configured with "snmpifspeed" as the attribute in a resource-filter

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Jeff Gehlbach August 18, 2014 at 3:57 PM

Pushed fix to master, cherry-picked to 1.12.

Jeff Gehlbach August 18, 2014 at 3:54 PM

I tracked this down to org.opennms.netmgt.collectd.SnmpIfData, whose method nullSafeUnbox(Long num, int dflt) incorrectly returns the result of num.intValue() whenever num is non-null. Changing this method to take (Long, long) and to return the result of num.longValue() in the non-null case resolves the problem on my own system.

Fixed

Details

Assignee

Reporter

Fix versions

Affects versions

Priority

PagerDuty

Created August 18, 2014 at 3:51 PM
Updated March 17, 2015 at 5:42 PM
Resolved August 18, 2014 at 3:57 PM

Flag notifications