Skip to end of banner
Go to start of banner

NMIS Handling Counter64 using SNMPv1

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Background

SNMP is a protocol specification which is standardised in the IETF, SNMPv1 does not support 64 bit counters, 64 bit counters were one of the primary drivers behind SNMPv2 and ultimately SNMPv2c.  SNMPv1 was ratified in 1990 with RFC 1155, RFC 1156 and RFC 1157, the MIB definitions were updated in RFC 1213.  SNMPv2c was ratified in 1996, making 2016 is 20th birthday.

Why are 64 bit counters important?

Cisco published a great article on this, SNMP Counters: Frequently Asked Questions, RFC 2233 summarises this best:

"As the speed of network media increase, the minimum time in which
a 32 bit counter will wrap decreases.  For example, a 10Mbs stream
of back-to-back, full-size packets causes ifInOctets to wrap in
just over 57 minutes; at 100Mbs, the minimum wrap time is 5.7
minutes, and at 1Gbs, the minimum is 34 seconds.  Requiring that
interfaces be polled frequently enough not to miss a counter wrap
is increasingly problematic."

The Problem

Despite this interesting bit of history, some Network Vendors, only support SNMPv1, which isn't a problem, unless you have high speed interfaces, for example 1 gigabit per second, which these vendors to have, funnily enough these same vendors companies have only existed for 10-15 years, so are younger than the standards they should be implementing.

So we have NMIS which is Open Source and by the nature of Open Source and of software using IETF protocols and specifications, NMIS is standards based.

Make NMIS work with SNMPv1 using 64 bit counters

NMIS itself is not strongly typed, the issue here is with the SNMP libraries NMIS uses.

How will I know I need to change NMIS?

NMIS will be reporting an error with SNMP, the message is "The Counter64 type is not supported in SNMPv1", this would be seen in the debug output and also in the NMIS Event log.  For example:

19:25:13 checkResult, SNMP ERROR (Ubiquiti-AirFiber1) (1.3.6.1.4.1.41112.1.3.3.1.1) The Counter64 type is not supported in SNMPv1

If you see this you have devices cheating and using a non standard combination.

What to change

To make NMIS work with non standard combination, you need to modify the SNMP library source code to prevent it from detecting the issue.  NMIS uses the Net::SNMP library and only one file in this library needs to be changed.  The file in question is Message.pm, or in Perl terms the class file Net::SNMP::Message, this is the object which manages the SNMP messages.
First locate Message.pm on your system, it will normally be in the perl directories in /usr/local or possibly in /usr
Run the Unix find command to do the work for you.

 

find /usr/local/ -name Message.pm 

The result would be something like this:

[root@nmis models]# find /usr/local/ -name Message.pm 
/usr/local/share/perl5/Net/LDAP/Message.pm
/usr/local/share/perl5/Net/SNMP/Message.pm
/usr/local/share/perl5/Mojo/Message.pm
/usr/local/share/perl5/HTTP/Message.pm

We are after the one for the class Net::SNMP::Message so the file we want (translating :: to /) is /usr/local/share/perl5/Net/SNMP/Message.pm, first thing, make a backup.

Edit the source code /usr/local/share/perl5/Net/SNMP/Message.pm and find "sub _process_counter64" in version 3.0.1 it is on line 1650 of the code.  You want to comment out the if statement which generates the error and returns, so just comment out the code with # as below, lines 1655 to 1657 have been commented out.
   1650 sub _process_counter64
   1651 {
   1652    my ($this, $type) = @_;
   1653 
   1654    # Verify the SNMP version
   1655    #if ($this->{_version} == SNMP_VERSION_1) {
   1656    #   return $this->_error('The Counter64 type is not supported in SNMPv1');
   1657    #}
   1658 
   1659    # Decode the length

That's it, run your NMIS update on the node in question, this will verify the code compiles and that NMIS works and should solve your problem, if  you get crazy Perl errors, restore your backup and try the edit again.

 

  • No labels