Page 1 of 4

Perl SNMP_Session.pm Exporter error

Posted: Tue Sep 29, 2015 3:04 pm
by glitchcowboy
I'm getting an error (email every 5 minutes) for the mrtg /etc/cron.d job:

Code: Select all

# LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
Subroutine SNMP_Session::pack_sockaddr_in6 redefined at /usr/share/perl5/vendor_perl/Exporter.pm line 66.
 at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMP_Session::unpack_sockaddr_in6 redefined at /usr/share/perl5/vendor_perl/Exporter.pm line 66.
 at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined at /usr/share/perl5/vendor_perl/Exporter.pm line 66.
 at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 604.
Subroutine SNMPv1_Session::unpack_sockaddr_in6 redefined at /usr/share/perl5/vendor_perl/Exporter.pm line 66.
 at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 604.

# locate SNMP_Session.pm
/usr/lib/mrtg2/SNMP_Session.pm
/usr/lib64/mrtg2/SNMP_Session.pm
/usr/share/perl5/vendor_perl/SNMP_Session.pm
# yum list perl-SNMP_Session
Loaded plugins: product-id, subscription-manager
Installed Packages
perl-SNMP_Session.noarch                                                                   1.13-5.el7                                                                   @rhel-7-server-rpms
#
Same issue as https://support.nagios.com/forum/viewto ... =6&t=29386

Code: Select all

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.1 (Maipo)
# uname -a
Linux dooku.apfcu.local 3.10.0-229.el7.x86_64 #1 SMP Thu Jan 29 18:37:38 EST 2015 x86_64 x86_64 x86_64 GNU/Linux
# 

Re: Perl SNMP_Session.pm Exporter error

Posted: Wed Sep 30, 2015 10:45 am
by lmiltchev
Did you try running the following command (as suggested in the other post)?

Code: Select all

yum install perl-Exporter -y

Re: Perl SNMP_Session.pm Exporter error

Posted: Fri Oct 02, 2015 1:48 pm
by glitchcowboy
Yep. 5.68-3.el7 is installed

Re: Perl SNMP_Session.pm Exporter error

Posted: Fri Oct 02, 2015 2:17 pm
by tgriep
Try reinstalling it and see if that resolves it for you. Run the following to do that.

Code: Select all

yum reinstall perl-Exporter -y

Re: Perl SNMP_Session.pm Exporter error

Posted: Thu Oct 15, 2015 12:04 pm
by chriscamm
I have the same error but I am on Centos 6.7 Final and

Code: Select all

yum install perl-Exporter
Is not available for install

If I do

Code: Select all

cpanm Exporter
Exporter is up to date. (5.72)
Any ideas

Thanks

Chris

Re: Perl SNMP_Session.pm Exporter error

Posted: Thu Oct 15, 2015 5:31 pm
by jdalrymple
Totally bizarre that it's not available for you.

Code: Select all

[jdalrymple@localhost bin]$ yum info perl-Exporter
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.tzulo.com
 * elrepo: ord.mirror.rackspace.com
 * epel: mirror.steadfast.net
 * extras: ftpmirror.your.org
 * rpmforge: mirror.nexcess.net
 * updates: mirror.cs.uwp.edu
Installed Packages
Name        : perl-Exporter
Arch        : noarch
Version     : 5.68
Release     : 3.el7
Size        : 55 k
Repo        : installed
From repo   : base
Summary     : Implements default import method for modules
URL         : http://search.cpan.org/dist/Exporter/
License     : GPL+ or Artistic
Description : The Exporter module implements an import method which allows a
            : module to export functions and variables to its users' name
            : spaces. Many modules use Exporter rather than implementing their
            : own import method because Exporter provides a highly flexible
            : interface, with an implementation optimized for the common case.
Whatever - I wonder if @INC isn't including your cpan path. I don't know why it wouldn't, but that would seem to be what's going on.

Maybe you could:

Code: Select all

use lib 'path/to/your/cpan/junk';

Re: Perl SNMP_Session.pm Exporter error

Posted: Fri Oct 16, 2015 2:32 pm
by chriscamm
Hi,

yes its very strange

Code: Select all

# yum info perl-Exporter
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
epel/metalink                                                                         |  26 kB     00:00     
 * base: mirrors.coreix.net
 * epel: mirrors.coreix.net
 * extras: centos.hyve.com
 * rpmforge: www.mirrorservice.org
 * updates: centos.hyve.com
base                                                                                  | 3.7 kB     00:00     
cr                                                                                    | 3.3 kB     00:00     
epel                                                                                  | 4.3 kB     00:00     
epel/primary_db                                                                       | 5.7 MB     00:09     
extras                                                                                | 3.4 kB     00:00     
nagios-base                                                                           | 1.5 kB     00:00     
nagiosxi-deps                                                                         | 1.5 kB     00:00     
rpmforge                                                                              | 1.9 kB     00:00     
updates                                                                               | 3.4 kB     00:00     
Error: No matching Packages to list
# 
Not sure where to add the use lib you have suggested.

Thanks

Chris

Re: Perl SNMP_Session.pm Exporter error

Posted: Sun Oct 18, 2015 11:47 am
by jdalrymple
After reading a bit more carefully I'm not necessarily expecting that this is a missing module problem, but we can try this anyway and if it doesn't fix it we'll just undo it and try something different.

So do this:

Code: Select all

[root@localhost jdalrymple]# find / -name Exporter.pm
/usr/share/perl5/vendor_perl/Exporter.pm
Then find the SNMP_Session.pm file from the error you're seeing. I have 3 such files on my system, none of which appear in the same location as the file referenced earlier in this thread. For that reason you should look to figure out exactly what file is causing you problems and edit only that one. Then use your editor of choice and add the line use lib /usr/share/perl5/vendor_perl; to that SNMP_Session.pm file just above the line use Exporter;. Of course replace the path that I used with whatever comes up on your system when you run the find command from above. Also note I did NOT explicitly specify the name of the module in "use lib", just the path.

Make sense?

Like I said, I don't have high hopes.

Re: Perl SNMP_Session.pm Exporter error

Posted: Mon Oct 19, 2015 3:58 am
by chriscamm
Hi,

Code: Select all

locate Exporter.pm
/root/.cpan/build/Exporter-5.72-36tiHs/blib/lib/Exporter.pm
/root/.cpan/build/Exporter-5.72-36tiHs/lib/Exporter.pm
/root/.cpan/build/Exporter-Tiny-0.042-VTe5hz/examples/Example/Exporter.pm
/root/.cpan/build/Filter-Simple-0.91-_aZ9WW/demo/Demo_Exporter.pm
/root/.cpan/build/Sub-Exporter-0.987-NInMVc/blib/lib/Sub/Exporter.pm
/root/.cpan/build/Sub-Exporter-0.987-NInMVc/lib/Sub/Exporter.pm
/root/.cpan/build/Test-Simple-1.001014-0W8zop/t/lib/NoExporter.pm
/root/.cpan/build/perl-5.22.0-ja8tEo/cpan/Test-Simple/t/lib/NoExporter.pm
/root/.cpan/build/perl-5.22.0-ja8tEo/dist/Exporter/lib/Exporter.pm
/usr/local/share/perl5/Exporter.pm
/usr/local/share/perl5/Sub/Exporter.pm
/usr/share/perl5/Exporter.pm

Code: Select all

locate SNMP_Session.pm
/usr/lib/mrtg2/SNMP_Session.pm
/usr/lib64/mrtg2/SNMP_Session.pm
/usr/share/perl5/SNMP_Session.pm
I have added use lib /usr/local/share/perl5; to all 3 files for SNMP_Session.pm

I have made the change and now I get

Code: Select all

syntax error at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 50, near "/usr/local"
Compilation failed in require at /usr/bin/../lib/mrtg2/SNMP_util.pm line 46.
BEGIN failed--compilation aborted at /usr/bin/../lib/mrtg2/SNMP_util.pm line 46.
Compilation failed in require at /usr/bin/../lib/mrtg2/MRTG_lib.pm line 662.
I might need to change these other files

Re: Perl SNMP_Session.pm Exporter error

Posted: Mon Oct 19, 2015 9:43 am
by SteveBeauchemin
If your system is like mine, you have 3 different SNMP_Session.pm files.
One in each of these locations.

/usr/lib/mrtg2/SNMP_Session.pm
/usr/lib64/mrtg2/SNMP_Session.pm
/usr/share/perl5/SNMP_Session.pm

(wrote this over the weekend and I see from your post that you do)

All are probably defined as the same version. Mine were version 1.12
grep for VERSION on them.
Yet, using diff, all 3 files have different content from each other. Nice huh.

They each have a subtle difference related to IP Version 6 socket.

1) import Socket6;
versus
2) Socket6->import(qw(pack_sockaddr_in6 inet_pton getaddrinfo));
versus
3) Socket6->import(qw(pack_sockaddr_in6 inet_pton getaddrinfo unpack_sockaddr_in6));

There are other small differences, but the Socket for using IP v6 is what matters.

I guessed that the file (3) with the longest line was the latest version, and copied over the others with it.

The cron errors are now stopped. All 3 files are the same.

Give this a shot - what can you lose...

Maybe keep copies of the original pm files in case you cause more harm than good, but I think this will fix it. It did for me.

I did one other thing, but am not sure it fixed anything.
I updated IO::Socket::INET6 from CPAN

Code: Select all

cpan -i IO::Socket::INET6
Steve B