mrtg를 구동하면 SNMP_Session 에러가 발생할 때가 있습니다.
[root@yongbok ~]# mrtg /usr/local/etc/mrtg/ruo91.cfg
Constant subroutine SNMP_Session::AF_INET6 redefined at /usr/local/lib/perl5/5.10.1/Exporter.pm line 67.
at /usr/local/lib/perl5/site_perl/5.10.1/SNMP_Session.pm line 149
Prototype mismatch: sub SNMP_Session::AF_INET6 () vs none at /usr/local/lib/perl5/5.10.1/Exporter.pm line 67.
at /usr/local/lib/perl5/site_perl/5.10.1/SNMP_Session.pm line 149
Constant subroutine SNMP_Session::PF_INET6 redefined at /usr/local/lib/perl5/5.10.1/Exporter.pm line 67.
at /usr/local/lib/perl5/site_perl/5.10.1/SNMP_Session.pm line 149
Prototype mismatch: sub SNMP_Session::PF_INET6 () vs none at /usr/local/lib/perl5/5.10.1/Exporter.pm line 67.
at /usr/local/lib/perl5/site_perl/5.10.1/SNMP_Session.pm line 149
Constant subroutine SNMPv1_Session::AF_INET6 redefined at /usr/local/lib/perl5/5.10.1/Exporter.pm line 67.
at /usr/local/lib/perl5/site_perl/5.10.1/SNMP_Session.pm line 604
Prototype mismatch: sub SNMPv1_Session::AF_INET6 () vs none at /usr/local/lib/perl5/5.10.1/Exporter.pm line 67.
at /usr/local/lib/perl5/site_perl/5.10.1/SNMP_Session.pm line 604
Constant subroutine SNMPv1_Session::PF_INET6 redefined at /usr/local/lib/perl5/5.10.1/Exporter.pm line 67.
at /usr/local/lib/perl5/site_perl/5.10.1/SNMP_Session.pm line 604
Prototype mismatch: sub SNMPv1_Session::PF_INET6 () vs none at /usr/local/lib/perl5/5.10.1/Exporter.pm line 67.
at /usr/local/lib/perl5/site_perl/5.10.1/SNMP_Session.pm line 604
Daemonizing MRTG …
이 에러는 SNMP_Session.pm 의 버그라고 하더군요.. 수동으로 fix 하셔야 합니다.
– Perl 5.8.9 경우
/usr/local/lib/perl5/site_perl/5.8.9/SNMP_Session.pm
– Perl 5.10.1 경우
/usr/local/lib/perl5/site_perl/5.10.1/SNMP_Session.pm
패치를 시작하고 mrtg를 다시시작 해보시면 됩니다.
– patch source
— SNMP_Session.pm.orig 2011-01-04 21:30:13.000000000 +0900
+++ SNMP_Session.pm 2011-01-04 21:31:52.000000000 +0900
@@ -146,7 +146,7 @@if (eval {local $SIG{__DIE__};require Socket6;} &&
eval {local $SIG{__DIE__};require IO::Socket::INET6; IO::Socket::INET6->VERSION(“1.26”);}) {
– import Socket6;
+ Socket6->import(qw(pack_sockaddr_in6 inet_pton getaddrinfo));
$ipv6_addr_len = length(pack_sockaddr_in6(161, inet_pton(AF_INET6(), “::1”)));
$SNMP_Session::ipv6available = 1;
}
@@ -601,7 +601,7 @@
BEGIN {
if($SNMP_Session::ipv6available) {
import IO::Socket::INET6;
– import Socket6;
+ Socket6->import(qw(pack_sockaddr_in6 inet_pton getaddrinfo));
}
}
[root@yongbok ~]# cd /usr/local/lib/perl5/site_perl/5.10.1
[root@yongbok ~]# wget http://mirror.yongbok.net/linux/patch/SNMP_Session.pm.patch
[root@yongbok ~]# patch -p0 < SNMP_Session.pm.patch
Hmm… Looks like a unified diff to me…
The text leading up to this was:
————————–
|— SNMP_Session.pm.orig 2011-01-04 21:30:13.000000000 +0900
|+++ SNMP_Session.pm 2011-01-04 21:31:52.000000000 +0900
————————–
Patching file SNMP_Session.pm using Plan A…
Hunk #1 succeeded at 146.
Hunk #2 succeeded at 601.
done
[root@yongbok ~]# mrtg /usr/local/etc/mrtg/ruo91.cfg
Daemonizing MRTG …
참고 (러시아)