Oct 28

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 🙂


Skip to comment form

    • Alan Simplicio on March 6, 2014 at 3:02 pm
    • Reply

    Thanks man, was already going crazy!

    1. I’m glad this post has helped you 🙂

    • MaReK on April 7, 2014 at 10:34 am
    • Reply

    Thx for your tutorial 🙂

    1. You are most welcome: )

    • Greg on May 30, 2014 at 11:32 am
    • Reply

    Thanks – its been driving me crazy for ages!

    1. 😀 it’s fixed now right

Leave a Reply

Your email address will not be published.