MRTG Reports SNMP_Session Errors in Nagios - Method to resolve this ?









Are you facing MRTG Reports SNMP_Session Errors while using Nagios? 

This guide is for you.


Sometimes, Nagios users experience MRTG Reports SNMP_Session Errors When running MRTG at the command line.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to resolve Nagios related issues.

In this context, we shall look into how to fix this Nagios error.


What to do when you experience MRTG Reports SNMP_Session Errors ?

Just recently, One of our customers ran the below MRTG on the command line:

LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok

As a result, he received the below errors;

Subroutine SNMP_Session::unpack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 604.

Now, let's see how our Support Experts tackle this issue.

1. First, we run the below command to make changes to the SNMP_Session.pm files.

There are several copies of these files so first, we must find them:

find /usr/ -name SNMP_Session.pm | grep mrtg

As a result of the above command, it would produce the below output.

/usr/lib64/mrtg2/SNMP_Session.pm
/usr/lib/mrtg2/SNMP_Session.pm

2. So first, we edit the first file using vi editor.

vi /usr/lib64/mrtg2/SNMP_Session.pm

3. Then we type /pack_sockaddr_in6 on the keyboard and press Enter. 

It will take us to the section where we want to edit.

4. We find the below line in the file:

Socket6->import(qw(pack_sockaddr_in6 inet_pton getaddrinfo));

5. Then we press i on the keyboard to go into insert mode. Now, we change the line so it looks as below:

Socket6->import(qw(inet_pton getaddrinfo inet_ntop));

Note: There can be multiple lines in the file that contain pack_sockaddr_in6

We repeat the above steps to find any other lines and update them.

6. After making the changes, we press the Escape button on the keyboard to exit the insert mode.

7. Finally, we save the file by entering :wq.

We repeat the above steps for all the SNMP_Session.pm files we find with the first command.

Lastly, after we complete all these steps, we run the MRTG again to ensure the errors are no longer produced:

LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok


[Need urgent assistance in fixing Nagios errors? – We are here to help you. ]

Conclusion

This article covers how to fix Nagios issue, MRTG Reports SNMP_Session Errors while using Nagios.

You can see this error when running MRTG at the command line such as:

LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok


When this Nagios error happens, you will receive error similar to this:

Subroutine SNMP_Session::pack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.

at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.




Keep In Touch

We hope to hear from you.

Accept File Type: jpg,jpeg,png,txt,pdf,doc,docx