MRTG: How to fix the 32-bit traffic counter wrap issue

Small networks don’t encounter problems by using the default MRTG configuration, because their traffic doesn’t exceed 100mbps. Go beyond the magic 120mbps mark (approximately) however, and you will see the wonderful 32 bit counter wrap issue, which results in something like this:

32 bit counter causes wrap issue on MRTG

You can see the traffic appears to be having drastic dips on the graph, but the network is basically unaffected.

Reason: network traffic exceeded the threshold for 32-bit counters and wraps itself. Basically, it goes back to 0 and starts afresh.

What can we do to fix it?

Poll the 64 bit counters of course.

There are two ways to do it:


Method 1

To adjust your target config in MRTG to aim the 64 bit counter, you need to add :::::2 to the end (note: five colons).

Sample target MRTG config /etc/mrtg/sample.cfg

Target[192.168.1.1_4]: 4:SNMPCOMMNAME@192.168.1.1:::::2


Method 2

Or you could get the correct interface OID counter via SNMP and poll that instead.

Sample scenario
OIDs were used on a Cisco router 192.168.1.1 with community name SNMPCOMMNAME, using snmpwalk to poll the relevant information. SNMPv2c was used, because SNMPv1 only supports 32 bit counters.

To check the correct interface by name:

server:~# snmpwalk -v2c -c SNMPCOMMNAME 192.168.1.1 .1.3.6.1.2.1.2.2.1.2

Sample output (filtered, you should get a whole chunk of interfaces here)

iso.3.6.1.2.1.2.2.1.2.4 = STRING: "GigabitEthernet1/0"

Note that 4 is the interface we want, so we will be targeting that number in the following queries.

Poll OID for incoming traffic, we are polling .4 here.

server:~# snmpwalk -v2c -c SNMPCOMMNAME 192.168.1.1 1.3.6.1.2.1.31.1.1.1.10.4

Sample output

iso.3.6.1.2.1.31.1.1.1.10.4 = Counter64: 6840321375245

Poll OID for outgoing traffic, once again polling .4 here.

server:~# snmpwalk -v2c -c SNMPCOMMNAME 192.168.1.1 .1.3.6.1.2.1.31.1.1.1.6.4

Sample output

iso.3.6.1.2.1.31.1.1.1.6.4 = Counter64: 1726867833662

Sample target MRTG config /etc/mrtg/sample.cfg

Target[192.168.1.1_4]: .1.3.6.1.2.1.31.1.1.1.6.4&.1.3.6.1.2.1.31.1.1.1.10.4:SNMPCOMMNAME@192.168.1.1

I have confirmed both methods work, so feel free to go either route. Thanks for reading and I hope this will help someone out there, saving the agony of having to go through this entire jig.

Enhanced by Zemanta
Advertisements

2 thoughts on “MRTG: How to fix the 32-bit traffic counter wrap issue

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.