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.
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
I am just checking to see which one runs clean.
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
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...
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
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