IPtables stats from Edgerouter via SNMP-part2


In part 1 we made the Edgerouter ready to publish some iptable counters via SNMP. In this part we are going to visualize it in the OpenNMS GUI 🙂

Setting up data collection

OpenNMS detects the edgerouter as a mib2 device. Therefore we need to add the definition of our iptables to “/opt/opennms/etc/datacollection/mib2.xml”. First we define a snmp-group with our 3 datapoints:

<group name="iptables" ifType="ignore">
   <mibObj oid="."
      instance="1" alias="iptables1" type="counter" />
   <mibObj oid="."
      instance="2" alias="iptables2" type="counter" />
   <mibObj oid="."
      instance="3" alias="iptables3" type="counter" />

In the same file we add to the systemDef name=”Enterprise” tag:


As you can see here it’s important that snmpd always returns the datapoints in the same order. They only arrive as index number, not with names! We have to keep track of what each index is.

Setting up the graphs

Edit the file “/opt/opennms/etc/snmp-graph.properties.d/mib2-graph.properties” and add the following to the buttom:

report.mib2.iptables1.name=WAN IN RULE 10 Bytes
report.mib2.iptables1.command=--title="IPtables bytes/sec for ruleset WAN_IN, rule 10 (accept,established)" \
 --vertical-label="Bytes Per Second" \
 DEF:queue={rrd1}:iptables1:AVERAGE \
 LINE2:queue#0000A0:"Size    " \
 GPRINT:queue:AVERAGE:"Avg  \\: %8.2lf %s" \
 GPRINT:queue:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:queue:MAX:"Max  \\: %8.2lf %s\\n"

report.mib2.iptables2.name=WAN IN RULE 10 Packets
report.mib2.iptables2.command=--title="IPtables packets/sec for ruleset WAN_IN, rule 10 (accept,established)" \
 --vertical-label="Packets Per Second" \
 DEF:queue={rrd1}:iptables2:AVERAGE \
 LINE2:queue#0000A0:"Size    " \
 GPRINT:queue:AVERAGE:"Avg  \\: %8.2lf %s" \
 GPRINT:queue:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:queue:MAX:"Max  \\: %8.2lf %s\\n"

report.mib2.iptables3.name=WAN LOCAL RULE 10000 Packets
report.mib2.iptables3.command=--title="IPtables dropped packets/sec for WAN_LOCAL" \
 --vertical-label="Packets Per Second" \
 DEF:queue={rrd1}:iptables3:AVERAGE \
 LINE2:queue#0000A0:"Size    " \
 GPRINT:queue:AVERAGE:"Avg  \\: %8.2lf %s" \
 GPRINT:queue:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:queue:MAX:"Max  \\: %8.2lf %s\\n"

In beginning of the file add to the “reports=” section:

mib2.iptables1, \
mib2.iptables2, \

In this file we put some real names and labels to our data. Therefore it is important to keep track of the index numbers… all the way from the snmp-iptables script, through snmpd and through OpenNMS datacollection.

In OpenNMS gui

After the files has been edited, you need to restart OpenNMS.

After some hours go to: Reports->Resource Graphs->Edgerouter->Nodelevel performance data.

Now you should see something like:

Leave a Reply

Your email address will not be published. Required fields are marked *