MRTG using perl-IO-Socket-INET6

 

MRTG is a very popular open source tool for server statistics. Wether you use it for traffic, CPU load, or whatever.

This package is part of standard tools for CentOS. Same counts for Perl, SNMP, etcetera.
Whenever you decide to use 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:

Depending on how often your CRON job is configured for running web statistics MRTG, you may receive following error:

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

This already is an old bug in MRTG: http://oss.oetiker.ch/mrtg-trac/ticket/45
There are several ways to fix this, like re-installing Perl, roll back your update (if you configured that).
I choose following fix:

Edit: /usr/bin/mrtg

Then find “import Socket6” (note: without the “;”) and replace it with:

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

Also edit: /usr/lib64/mrtg2/SNMP_Session.pm

Then find “import Socket6;”  (note: with the “;”)

note: there are 2 instances

replace them both again, like above.