Data collection using netstat and Net-SNMP extend does not work



opennms ver 23.0.2

I set up an extend script that does “netstat -tunlp”
When i query it’s extend OID i get this response
. = STRING: 11
What follows is the datacollection file I set up.

. class-oids

The rcvpkts.rrd file appears under the node number correctly but when I do a rrdtool dump I dont see any value other than zero in the array. Since the values are zero the graph also does not appear.
But when I do an NRT graph I can see the value 11 appearing.

To do some troubleshooting - I replaced the extend script with “echo $RANDOM” - With the same oid, the RRD shows non-zero values and I can graph it too. Response I get with the snmp query is
. = STRING: 24508

Does this have something to do with the number being very small? Both come back as string values.

I also compared with another standard object tcpCurrEstab that is in mib2.xml. It generally reponds with a small number such as 1 or 2. This is the snmpwalk response
. = Gauge32: 1
the rrd file is good and so is the graph.

The difference I can see is that my script responds with a STRING value while tcpCurrentEstab comes back with Gauge32: 1.
I am also using type of Gauge32.

How do I fix this? I am fairly new to opennms so any help would be appreciated


I think your issue is that a STRING value can’t be used in a graph. It would need to be stored as a GAUGE to be able to graph it.


That is what I thought but the OID for echo RANDOM$ also returns a string and that appears in the rrd file and graphable too. I will try and convert the value to a number and see if it works. Thanks


@renjia Can you provide a snmpwalk for EXTEND MIB?

You can use the following commands:

snmpwalk -v2c -c COMMUNITY IP_ADDRESS .
snmpwalk -v2c -On -c COMMUNITY IP_ADDRESS .

Also, it would be helpful, if you could paste your datacollection config and the exact extend command you are using.



netstat -tulnp | wc -l


extend testrevive /tmp/

snmpwalk and its response

snmpwalk -v2c -c public ??.??.??.?? .

NET-SNMP-EXTEND-MIB::nsExtendOutLine.“testrevive”.1 = STRING: 12





  <include-collection dataCollectionGroup="VMware6"/>

Strangely, I deleted the rrd and I restarted opennms becuase i had attempted couple of things and i wanted to normalize thing. Now I can see both the rrd and the graph appearing as it should - though the snmpwaljk still shows the response as a string.

rrdtool dump /var/opennms/rrd/snmp/3/rcvpkts.rrd | grep “2019-03-05 15:”

    <lastupdate>1551816801</lastupdate> <!-- 2019-03-05 15:13:21 EST -->

                    <!-- 2019-03-05 15:00:00 EST / 1551816000 --> <row><v>1.1000000000e+01</v></row>

                    <!-- 2019-03-05 15:05:00 EST / 1551816300 --> <row><v>1.1000000000e+01</v></row>

                    <!-- 2019-03-05 15:10:00 EST / 1551816600 --> <row><v>1.1000000000e+01</v></row>

                    <!-- 2019-03-05 15:00:00 EST / 1551816000 --> <row><v>7.3783333333e+00</v></row>

Dont know what to make of it.