Friday, March 1, 2013

MRTG error through CRON - "Subroutine SNMP Session - pack sockaddr in6 redefined"

The Multi Router Traffic Grapher (MRTG) is a tool to monitor the traffic load on network-links. MRTG generates HTML pages containing GIF images which provide a LIVE visual representation of this traffic.

This package is standard tools for CentOS. Same counts for Perl, SNMP etc. Whenever we wish to add an additional repository for server maintenance, e.g, the Atomic Rocket Turtle repo, then you might run into some problems these days.
The rocket turtle has released an update for Perl-IO-Socket-INET6, which is used in MRTG. This might bring some problems like following:

Subroutine SNMPv1_Session::AF_INET6 redefined at /usr/lib/perl5/5.8.8/Exporter.pm line 65. at /usr/bin/../lib64/mrtg2/SNMP_Session.pm line 594 Subroutine main::AF_INET6 redefined at /usr/lib/perl5/5.8.8/Exporter.pm line 65. at /usr/bin/mrtg line 97


For the fix, go through the following

1) Edit the binary file of MRTG, get it from #which mrtg
vi /usr/bin/mrtg
Then replace import Socket6;
with Socket6->import(qw(pack_sockaddr_in6 inet_pton getaddrinfo));
2) Edit the file /usr/lib/mrtg2/SNMP_Session.pm . If the server is 64 bit then edit /usr/lib64/mrtg2/SNMP_Session.pm
Replace two instances of entry Socket6->import(qw(pack_sockaddr_in6 inet_pton getaddrinfo)); or import Socket6;
with Socket6->import(qw(inet_pton getaddrinfo));
You are done :)

No comments:

Post a Comment