Perl SNMP_Session.pm Exporter error
Re: Perl SNMP_Session.pm Exporter error
Hi Steve,
I was already up to date on cpan so I have made the change.
I will let you know
Thanks
Chris
I was already up to date on cpan so I have made the change.
I will let you know
Thanks
Chris
Re: Perl SNMP_Session.pm Exporter error
Still get this after updating all three files
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.-
SteveBeauchemin
- Posts: 524
- Joined: Mon Oct 14, 2013 7:19 pm
Re: Perl SNMP_Session.pm Exporter error
Don't forget - the error changed after you were asked to edit the files, making a change to some lib.
You introduced a compile error...
You need to get back to the "subroutine redefined" error. Look back to your original posts.
Once you remove that edit, you have a better chance to fix the original problem.
Thanks
Steve B
That then changed the error to some other failure.I have added use lib /usr/local/share/perl5; to all 3 files for SNMP_Session.pm
You introduced a compile error...
You need to get back to the "subroutine redefined" error. Look back to your original posts.
Once you remove that edit, you have a better chance to fix the original problem.
Thanks
Steve B
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
Re: Perl SNMP_Session.pm Exporter error
Hi Steve,
I edited the three SNMP_Session.pm files and removed the use lib /usr/local/share/perl5;
I now get the following errors:
Thanks
Chris
I edited the three SNMP_Session.pm files and removed the use lib /usr/local/share/perl5;
I now get the following errors:
Code: Select all
Subroutine SNMP_Session::pack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMP_Session::unpack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 604.
Subroutine SNMPv1_Session::unpack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 604.
syntax error at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 654, near ") {"
Global symbol "$socket" requires explicit package name at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 684.
Global symbol "$socket" requires explicit package name at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 685.
Global symbol "$community" requires explicit package name at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 686.
Global symbol "$remote_hostname" requires explicit package name at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 687.
Global symbol "$remote_addr" requires explicit package name at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 688.
Global symbol "$sockfamily" requires explicit package name at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 689.
Global symbol "$max_pdu_len" requires explicit package name at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 690.
Global symbol "$max_pdu_len" requires explicit package name at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 691.
Global symbol "$max_repetitions" requires explicit package name at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 700.
syntax error at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 708, near "}"
/usr/bin/../lib/mrtg2/SNMP_Session.pm has too many errors.
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.Chris
Re: Perl SNMP_Session.pm Exporter error
Try this (exact keystrokes, my comments after # should be ignored):
Code: Select all
vi /usr/bin/../lib/mrtg2/SNMP_Session.pm
:708
#You should be on a "}"
%
#Let us know what line is shown, it should be "sub open {" otherwise you might see an error at the bottom, post that here
:q
Former Nagios employee
Re: Perl SNMP_Session.pm Exporter error
Hi I have sorted the line error I have put an extra character in
Here is the code now
Here is the code now
Code: Select all
Subroutine SNMP_Session::pack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMP_Session::unpack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 604.
Subroutine SNMPv1_Session::unpack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 604.
Re: Perl SNMP_Session.pm Exporter error
Hi it does not matter which of these I put in to both lines I get the same errors
Code: Select all
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));-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Perl SNMP_Session.pm Exporter error
Did you per chance try that?SteveBeauchemin wrote: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
-
SteveBeauchemin
- Posts: 524
- Joined: Mon Oct 14, 2013 7:19 pm
Re: Perl SNMP_Session.pm Exporter error
I suspect that edits to your file may be causing some grief. I do not really know. but... read on.
I am in the middle of setting up a new Nagios XI 5 system.
So far, I have proven that it has this same MRTG problem with perl Subroutine complaints.
I am carefully fixing it and writing down each step I take.
First I am 'finding' all the suspicious files as the root user.
./usr/lib/mrtg2/SNMP_Session.pm
./usr/lib64/mrtg2/SNMP_Session.pm
./usr/share/perl5/vendor_perl/SNMP_Session.pm
So I have 3 files. I am copying them to a safe location for posterity, and in
case I need to revert. I do this because of many lessons learned where I thought I
would not need the old file. I am also changing the name to reflect the source location.
I am just checking to see which one runs clean.
From the /etc/cron.d/mrtg file I get the run syntax
Without copying anything I want to see which file is used from what location.
When I run that line I can see from the error that it is using the file from /usr/lib/mrtg2
So I can eliminate that /lib/ file as a candidate.
It gives me 6 errors of this flavor. Not identical, but more than zero is too many.
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.
From my safe location, I can copying over the bad file. Trying the vendor file first.
Actually copied over all the files. I made sure all 3 were the same.
cp /tmp/SNMP_Session.pm-vendor /usr/lib/mrtg2
cp /tmp/SNMP_Session.pm-vendor /usr/lib64/mrtg2
cp /tmp/SNMP_Session.pm-vendor /usr/share/perl5/vendor_perl
Ran the mrtg test line and no good. Similar problem, but only subroutine 4 errors.
Trying the lib64 file next. Last file - it's always the last one you try...
Now when I run the command it does not complain any more.
So I had 3 files with different innards. Tried them each one at a time.
Found one that does not have perl errors during execution.
I suggest you copy your files somewhere in case they have edits.
I have attached the file I ended up using.
To recap, my locations are these. Yours could be different.
/usr/lib/mrtg2/
/usr/lib64/mrtg2/
/usr/share/perl5/vendor_perl/
Each of those locations should have the SNMP_Session.pm file replaced.
That's my story, and I'm sticking to it.
Please see attached.
Steve B
I am in the middle of setting up a new Nagios XI 5 system.
So far, I have proven that it has this same MRTG problem with perl Subroutine complaints.
I am carefully fixing it and writing down each step I take.
First I am 'finding' all the suspicious files as the root user.
Code: Select all
cd /
find . -name SNMP_Session.pm
./usr/lib64/mrtg2/SNMP_Session.pm
./usr/share/perl5/vendor_perl/SNMP_Session.pm
So I have 3 files. I am copying them to a safe location for posterity, and in
case I need to revert. I do this because of many lessons learned where I thought I
would not need the old file. I am also changing the name to reflect the source location.
Code: Select all
cp /usr/lib/mrtg2/SNMP_Session.pm /tmp/SNMP_Session.pm-lib
cp /usr/lib64/mrtg2/SNMP_Session.pm /tmp/SNMP_Session.pm-lib64
cp /usr/share/perl5/vendor_perl/SNMP_Session.pm /tmp/SNMP_Session.pm-vendor
From the /etc/cron.d/mrtg file I get the run syntax
Code: Select all
/usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
When I run that line I can see from the error that it is using the file from /usr/lib/mrtg2
So I can eliminate that /lib/ file as a candidate.
It gives me 6 errors of this flavor. Not identical, but more than zero is too many.
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.
From my safe location, I can copying over the bad file. Trying the vendor file first.
Actually copied over all the files. I made sure all 3 were the same.
cp /tmp/SNMP_Session.pm-vendor /usr/lib/mrtg2
cp /tmp/SNMP_Session.pm-vendor /usr/lib64/mrtg2
cp /tmp/SNMP_Session.pm-vendor /usr/share/perl5/vendor_perl
Ran the mrtg test line and no good. Similar problem, but only subroutine 4 errors.
Trying the lib64 file next. Last file - it's always the last one you try...
Code: Select all
cp /tmp/SNMP_Session.pm-lib64 /usr/lib/mrtg2/
cp /tmp/SNMP_Session.pm-lib64 /usr/lib64/mrtg2/
cp /tmp/SNMP_Session.pm-lib64 /usr/share/perl5/vendor_perl
So I had 3 files with different innards. Tried them each one at a time.
Found one that does not have perl errors during execution.
I suggest you copy your files somewhere in case they have edits.
I have attached the file I ended up using.
To recap, my locations are these. Yours could be different.
/usr/lib/mrtg2/
/usr/lib64/mrtg2/
/usr/share/perl5/vendor_perl/
Each of those locations should have the SNMP_Session.pm file replaced.
That's my story, and I'm sticking to it.
Please see attached.
Steve B
You do not have the required permissions to view the files attached to this post.
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
Re: Perl SNMP_Session.pm Exporter error
Hi,
So I reverted back to my original files
I then did:
Then I ran
Here is the output
Now I copied the lib64 backup over the existing files:
This is the output of the next run:
So I tried with the last one:
Here is the output
So looking at this the lib64 looks to be the closest to correcting the problems so what does line 149 and 604 say in this version of the file:
Now in the text file Steve so kindly uploaded his line 149 and 604 are as follows:
Not sure where that line came from as that is not in any of my files at all? In fact the original dates of the files I have are:
So not sure if a newer version of the files should have come down in the upgrade from 4 to 5 or if there a package to update for the installation?
Next step is to replace lines 149 and 604 with the lines provided by Steve B in his attachment and now this is the output
Here is the output now:
Interested to know where the new code line came from
Thanks very much to Steve and everyone else for there help getting to the bottom of this. Much appreciated.
So I reverted back to my original files
I then did:
Code: Select all
cp /usr/lib/mrtg3/SNMP_Session.pm /tmp/SNMP_Session.pm-lib
cp /usr/lib64/mrtg3/SNMP_Session.pm /tmp/SNMP_Session.pm-lib64
cp /usr/share/perl5/SNMP_Session.pm /tmp/SNMP_Session.pm-perl5
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
Code: Select all
Subroutine SNMP_Session::pack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMP_Session::unpack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 604.
Subroutine SNMPv1_Session::unpack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 604.
Code: Select all
cp /tmp/SNMP_Session.pm-lib64 /usr/lib/mrtg2/SNMP_Session.pm
cp /tmp/SNMP_Session.pm-lib64 /usr/lib64/mrtg2/SNMP_Session.pm
cp /tmp/SNMP_Session.pm-lib64 /usr/share/perl5/SNMP_Session.pm
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/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 604.Code: Select all
cp /tmp/SNMP_Session.pm-perl5 /usr/lib/mrtg2/SNMP_Session.pm
cp /tmp/SNMP_Session.pm-perl5 /usr/lib64/mrtg2/SNMP_Session.pm
cp /tmp/SNMP_Session.pm-perl5 /usr/share/perl5/SNMP_Session.pm
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/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMP_Session::unpack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMP_Session::sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 604.
Subroutine SNMPv1_Session::unpack_sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 604.
Subroutine SNMPv1_Session::sockaddr_in6 redefined at /usr/local/share/perl5/Exporter.pm line 66.
at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 604.
Code: Select all
Line 149
Socket6->import(qw(pack_sockaddr_in6 inet_pton getaddrinfo));
Line 604
Socket6->import(qw(pack_sockaddr_in6 inet_pton getaddrinfo));
Code: Select all
Socket6->import(qw(inet_pton getaddrinfo inet_ntop));Code: Select all
ls -lah /usr/lib/mrtg2/SNMP_Session.pm
-rw-r--r-- 1 root root 35K Jun 1 2014 /usr/lib/mrtg2/SNMP_Session.pm
ls -lah /usr/lib64/mrtg2/SNMP_Session.pm
-rw-r--r-- 1 root root 35K Nov 12 2012 /usr/lib64/mrtg2/SNMP_Session.pm
ls -lah /usr/share/perl5/SNMP_Session.pm
-rw-r--r-- 1 root root 35K Mar 19 2008 /usr/share/perl5/SNMP_Session.pm
Next step is to replace lines 149 and 604 with the lines provided by Steve B in his attachment and now this is the output
Code: Select all
Replaced:
Socket6->import(qw(pack_sockaddr_in6 inet_pton getaddrinfo));
With:
Socket6->import(qw(inet_pton getaddrinfo inet_ntop));
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.okThanks very much to Steve and everyone else for there help getting to the bottom of this. Much appreciated.