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 🙂

Add more space to /tmp in cPanel server.

The following could help you to increase more space in /tmp.

You need to make alternation in the file /scripts/securetmp

#vi /scripts/securetmp

Find the entry my $tmpdsksize under Global Variables as follows:


# Global Variables
my $tmpdsksize = 512000; # Must be larger than 250000

Change the value for that particular entry to desired size.

Then make sure that no processes are using /tmp using the command, lsof /tmp

Please stop the service /etc/init.d/mysql stop. Also delete the file, /usr/tmpDSK if it exists by rm -rf /usr/tmpDSK

Then

umount /tmp

Run the script

#/scripts/securetmp

Then you will asked for some confirmation steps.

“Would you like to secure /tmp at boot time?” Press y

“Would you like to secure /tmp now?” Press y

Eventually you can see the upgraded space to /tmp in server 🙂