[mrtg] SNMP_Session error

Niall O'Reilly niall.oreilly at ucd.ie
Tue Jan 3 15:41:53 CET 2017

On 2 Jan 2017, at 11:33, Nick Price wrote:

> HI All
> I have just install fedora 25 with all the updates for it and perl to 
> latest versions
> I installed mrtg (2.17.4) and when I run it I get in the crontab mail 
> box
> Subroutine SNMP_Session::pack_sockaddr_in6 redefined at 
> /usr/share/perl5/vendor_perl/Exporter.pm line 66.
> at /usr/local/mrtg-2/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/local/mrtg-2/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/local/mrtg-2/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/local/mrtg-2/bin/../lib/mrtg2/SNMP_Session.pm line 604.
> I have copied the SNMP_Sessions.pm from mrtg folder to the perl folder 
> and I still get this.
> My last install of fedora was ver 22 and doing this cured it this time 
> it hasn't
> Any ideas as this is flooding the mailbox every 5 minutes

   Since you ask ...

   Whenever I've seen the kind of messages you've shown above, they've 
been fallout
   from sloppy initialization code in one or a couple of Perl modules 
resulting in
   repeated definitions of the same subroutine.  For me, there were two 
reasons for
   this to be inconsequential; first: any subsequent code re-definition 
seemed to be
   compatible with the original one, so the application just worked; 
second: I always
   used to run MRTG in daemon mode in order to avoid the repeated 
startup overhead
   involved in using cron to launch each sampling run.

   You don't say whether MRTG is otherwise working correctly for you, so 
I don't
   know whether the re-definitions have any other effect than flooding 
your e-mail.

   If reducing the noise is all you need to do, three options occur to 
me, of which
   tracking down the root of the problem and eliminating the 
redefinitions is the
   "most correct", but likely the most troublesome.  Moreover, this 
option may be
   subverted by any future upgrade of one or other of the collection of 
   on which MRTG depends.

   MRTG's daemon mode will eliminate repeated startup of MRTG, and so 
   repeated emission of startup-time warnings.  You'll need to configure 
   mode in your MRTG configuration file, and provide or obtain a 
suitable init
   script or systemd configuration for starting and stopping the MRTG 

   Another approach, which I've used on occasion for some other 
application, is
   to invoke a wrapper script from cron; this might redirect error 
output to a
   temporary file, somehow check for a "real" failure, and only generate 
   for cron to send on by mail in case such a failure occurred.

   I'ld happily let you have the scripts I used to use in a previous job 
for each
   of these approaches, but have some connectivity trouble just now and 
so am
   without the necessary access.

   I hope this is of some help.

   Best regards,
   Niall O'Reilly

More information about the mrtg mailing list