In Nagios, does the MRTG Reports SNMP_Session Errors? We can help you in fixing this problem.
Here at Bobcares, we have seen several such Nagios-related issues as part of our Server Management Services for web hosts and online service providers.
Today, let us see how our Support Engineers fix this Nagios problem for our customers.
How to tackle MRTG Reports SNMP_Session Errors
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 us see how our Support Engineers assist our customers in fixing this Nagios problem.
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
So first, we edit the first file using vi editor.
vi /usr/lib64/mrtg2/SNMP_Session.pm
Then we type /pack_sockaddr_in6 on the keyboard and press Enter. It will take us to the section where we want to edit.
We find the below line in the file:
Socket6->import(qw(pack_sockaddr_in6 inet_pton getaddrinfo));
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.
After making the changes, we press the Escape button on the keyboard to exit the insert mode.
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 any further assistance in fixing Nagios errors? – We are here to help you]
Conclusion
Today, we saw the solution our Support Engineers provide a solution this Nagios problem.
wow, that worked perfectly. thank you!
Hi Kevin,
Thanks for the feedback. We are glad to know that our article was helpful for you 🙂 .