Counter variables reported as strings (like Net-SNMP extent) are not stored properly when using RRDtool

Description

Here is how to reproduce the problem.

On my CentOS 6.7 VM running Meridian 2015.1.0, I configured the local snmpd.conf with this:

/etc/snmp/snmpd.conf

The script that simulates the counter is very simple:

/etc/snmp/counter.pl

If you execute the script it will always return an increasing number:

In OpenNMS, I have a file called /opt/opennms/etc/datacollection/sample.xml with the following content:

/opt/opennms/etc/datacollection/sample.xml

Of course, I've added a reference to it on datacollection-config.xml:

Now, let's try the OID using snmp-request (I use snmp-request, a clone of Net-SNMP's tools based on SNMP4J, because the snmpwalk command is not as good as SNMP4J in terms of the SNMP Protocol implementation):

The last entry is what we have on the datacollection-group.

Now, let's see how Collectd is handling that data:

As you can see, the values are stored like float numbers (i.e. numbers with decimals), which is a non valid operation for counters on RRDtool.

Of course, the values are not being stored on the RRDtool file:

Seeing the source code, I found the following:

org.opennms.netmgt.collectd.SnmpAttribute

The key element here is how isNumeric is implemented:

org.opennms.netmgt.snmp.snmp4j.Snmp4JValue

Because the extent feature of Net-SNMP returns the value as string, isNumeric will return false, so it will converted into a double, which is not correct for these case.

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Alejandro Galue August 13, 2015 at 12:09 PM

Here is the solution:

The solution was verified on the same VM used to report the problem:

Fixed on 09146bd64f126cd0a0a9128cd0bbb0ab782d5863 for foundation.

This will be merged into develop, and from then we can cherty-pick it into 16.0.3

Fixed

Details

Assignee

Reporter

Labels

Components

Priority

PagerDuty

Created August 13, 2015 at 11:42 AM
Updated August 14, 2015 at 1:32 PM
Resolved August 13, 2015 at 12:09 PM