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

datacollection
net-snmp
snmp

#1

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
.1.3.6.1.4.1.8072.1.3.2.4.1.2.10.116.101.115.116.114.101.118.105.118.101.1 = STRING: 11
What follows is the datacollection file I set up.

.1.3.6.1.4.1.8072. 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
.1.3.6.1.4.1.8072.1.3.2.4.1.2.10.116.101.115.116.114.101.118.105.118.101.1 = 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
.1.3.6.1.2.1.6.9.0 = 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


#2

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.


#3

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


#4

@renjia Can you provide a snmpwalk for EXTEND MIB?

You can use the following commands:

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

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


#5

rx_packets.sh

#!/bin/bash

netstat -tulnp | wc -l

snmpd.conf

extend testrevive /tmp/rx_packets.sh

snmpwalk and its response

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

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

myclass.xml

.1.3.6.1.4.1.8072.

class-oids

datacollection-config.xml

  <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.

Thanks

Renji