Can't locate object method "new" via package "SNMP::Session" (perhaps you forgot to load "SNMP::Session"?) at ./snmp_interface.monitor line 93.
Other solutions have suggested that I run perl -MSNMP, but that is giving a strange output, being blank:
/usr/bin/perl -MSNMP -e 'print $SNMP::VERSION, "\n"'
not unfound, just blank; whereas other modules give me an answer:
/usr/bin/perl -MIO -e 'print $IO::VERSION, "\n"'
1.21
or an unfound answer:
[root@mrtg sourcecode]# /usr/bin/perl -MDBS -e 'print $DBS::VERSION, "\n"'
Can't locate DBS.pm in @INC (@INC contains: /usr/lib/perl5/5.8.5/i386-linux-thread-multi /usr/lib/perl5/5.8.5
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5
/usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2 /usr/lib/perl5/site_perl/5.8.1
/usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4
/usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.2 /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl .).
BEGIN failed--compilation aborted.
I have searched high and low for this solution, and am running into brick walls everywhere. Here are some system details:
[root@mrtg mon.d]# uname -a
Linux mrtg.ndtel.com 2.6.9-34.0.1.ELsmp #1 SMP Wed May 24 08:14:29 CDT 2006 i686 athlon i386 GNU/Linux
[root@mrtg mon.d]# cat /etc/redhat-release
CentOS release 4.3 (Final)
[root@mrtg mon.d]# perl -V
Summary of my perl5 (revision 5 version 8 subversion 5) configuration:
Platform:
osname=linux, osvers=2.6.9-22.0.1.elsmp, archname=i386-linux-thread-multi
uname='linux build-i386 2.6.9-22.0.1.elsmp #1 smp thu oct 27 13:14:25 cdt 2005 i686 i686 i386 gnulinux '
config_args='-des -Doptimize=-O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -Dversion=5.8.5 -Dmyhostname=localhost -Dperladmin=root@localhost
-Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib
-Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio
-Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dinc_version_list=5.8.4 5.8.3 5.8.2 5.8.1 5.8.0'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2 -g -pipe -m32 -march=i386 -mtune=pentium4',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='3.4.4 20050721 (Red Hat 3.4.4-2)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.3.4.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.3.4'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
Built under linux
Compiled at Dec 21 2005 06:35:04
@INC:
/usr/lib/perl5/5.8.5/i386-linux-thread-multi
/usr/lib/perl5/5.8.5
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.5
/usr/lib/perl5/site_perl/5.8.4
/usr/lib/perl5/site_perl/5.8.3
/usr/lib/perl5/site_perl/5.8.2
/usr/lib/perl5/site_perl/5.8.1
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.5
/usr/lib/perl5/vendor_perl/5.8.4
/usr/lib/perl5/vendor_perl/5.8.3
/usr/lib/perl5/vendor_perl/5.8.2
/usr/lib/perl5/vendor_perl/5.8.1
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl
Thanks for any suggestions you can give.
Alex
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-users mailing list
Net-snm...@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
> I am using the "mon" monitoring program, and one of the
> monitors requires the use of the Net::SNMP module. I have
> installed the module as many
> different ways that I can, ending with refreshing the
> original RPMs from the distribution. However, the software
> still gives me the same error:
>
> Can't locate object method "new" via package "SNMP::Session"
> (perhaps you forgot to load "SNMP::Session"?) at
> ./snmp_interface.monitor line 93.
>
> Other solutions have suggested that I run perl -MSNMP, but
> that is giving a strange output, being blank:
>
> /usr/bin/perl -MSNMP -e 'print $SNMP::VERSION, "\n"'
>
> not unfound, just blank; whereas other modules give me an answer:
I don't have an answer, so I'll just blantantly plagiarize Dave Shield:
> There are basically two alternative SNMP perl modules.
> One is a "pure-perl" implementation, called "Net::SNMP"
> and develeped by David Town.
> The other is a perl interface to the Net-SNMP C libraries,
> which comes as two separate packages - SNMP and Net-SNMP.
> These are therefore closely linked with the C library code.
>
> The SNMP::Info module is a higher-level convenience module,
> using the Net-SNMP perl modules (i.e. SNMP/Net-SNMP).
>
>
> The SNMP::Info documentation tells you not to install SNMP or
> Net::SNMP from CPAN - but the reasons are different for each of
> these two packages.
>
> You shouldn't install Net::SNMP because the SNMP::Info
> module is not written to use the Net::SNMP api. It's the wrong
> package for this module, so there's no point in installing it.
>
> You *should* install SNMP/Net-SNMP - but not from CPAN.
> Because these modules are closely linked with the C library,
> they rely on having the correct version of the library installed.
> There can be minor changes to the library internals from one
> release to another, which wouldn't affect most applications
> but can break the perl internals.
>
> The safest approach is to install the SNMP perl modules from
> the same Net-SNMP distribution as the C libraries that you are
> using. That's the most reliable way to ensure compatibility.
>
> If you are using a vendor-supplied version of the Net-SNMP suite,
> then they ought to provide a package that includes the perl APIs
> as well. If you compiled things yourself from source, then
>
> ./configure --with-perl-modules
>
> will build the correct perl API modules as well.
>
>
> I trust that makes things a bit clearer.
HTH,
Mike
Does it require the "Net::SNMP" module, or the "Net-SNMP" module?
As Mike has indicated, these are different perl modules.
> Can't locate object method "new" via package "SNMP::Session"
That object is part of the "Net-SNMP" module.
> Other solutions have suggested that I run perl -MSNMP, but that is
> giving a strange output, being blank:
>
> /usr/bin/perl -MSNMP -e 'print $SNMP::VERSION, "\n"'
Hmmm... I get:
$ /usr/bin/perl -MSNMP -e 'print $SNMP::VERSION, "\n";'
5.0301
as expected.
> Here are some system details:
> [root@mrtg mon.d]# cat /etc/redhat-release
> CentOS release 4.3 (Final)
I'm not familiar with CentOS, but assuming it's a reasonably
standard Linux distribution, I would expect it to have the 'locate'
command. What does
locate SNMP.pm
report?
Dave
> Now, 3 questions:
> 1. Should I uninstall (-e) the Net::SNMP stuff I have already
> installed before compiling and installing Net-SNMP?
I don't think that will be necessary.
> 2. Any particular version of Net-SNMP suggested?
You *must* use the same version of the Net-SNMP perl module as your master agent. As always, latest stable (5.4.1) is suggested.
> 2. Will this affect MRTG? (I think it will not... MRTG seems
> to be self-contained, but the question bears asking anyway.)
I'm not sure, but I doubt it. SNMP "client"[1] code is usually compiled in.
> Dave Shield wrote:
> > I'm not familiar with CentOS, but assuming it's a reasonably
> > standard Linux distribution, I would expect it to have the 'locate'
> > command. What does
CentOS is a popular RedHat derivative.
HTH,
Mike
All three of those are on the search path you listed,
so should be being picked up.
> /usr/lib/perl5/5.8.5/i386-linux-thread-multi/SNMP/SNMP.pm
> /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/SNMP.pm
Those two locations wouldn't be found.
> /usr/lib/perl5/site_perl/5.8.5/Mon/SNMP.pm
> /usr/lib/perl5/site_perl/5.8.5/Net/SNMP.pm
Those two are part of different perl modules
(Jim Trocki's "mon" trap handler, and David Town's
"Net::SNMP" module respectively).
If you are using the SNMP::Session interface,
then they're not relevant here.
> /usr/local/source/SNMP-5.0401/SNMP.pm
> /usr/local/source/net-snmp-5.4.1/perl/SNMP/SNMP.pm
> /usr/local/source/mon-client-1.2.0/Mon/SNMP.pm
> /usr/local/source/mon-client-1.2.0/blib/lib/Mon/SNMP.pm
Those are all part of the original source builds, so again
are not relevant.
> Now, 3 questions:
> 1. Should I uninstall (-e) the Net::SNMP stuff I have already installed before
> compiling and installing Net-SNMP?
> 2. Any particular version of Net-SNMP suggested?
> 2. Will this affect MRTG?
I'd second Mike's answers here.
The presence/absence of the Net::SNMP module is irrelevant.
What I would be tempted to do is to remove *all* of the various
Net-SNMP-based perl modules (see the files under
/usr/local/source/net-snmp-5.4.1/perl for a list of what this
contains), and start again from scratch.
As Mike says, you *must* use the perl code that matches
the C library that you have installed. Mixing versions is
likely to cause problems, and that may well be what's
hitting you at the moment.
Get rid of all the previous attempts, and try again with
your source code build.
Dave
When I try to "manually" install the Perl modules by entering the net-snmp-5.4.1/perl directory and running the "perl Makefile.PL/make/make test/make
install" procedure, I run into the following error when I run "make test":
Can't load '../blib/arch/auto/NetSNMP/default_store/default_store.so' for module NetSNMP::default_store: libcrypto.so.6: cannot open shared object
file: No such file or directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230.
at test.pl line 97
Compilation failed in require at test.pl line 97.
BEGIN failed--compilation aborted at test.pl line 97.
not ok 1
make[1]: *** [test_dynamic] Error 255
make[1]: Leaving directory `/usr/local/source/net-snmp-5.4.1/perl/default_store'
make: *** [test] Error 2
Looks like my libcrypto library is too old. I have:
/lib/libcrypto.so.0.9.7a
/lib/libcrypto.so.4
/usr/lib/libcrypto.a
/usr/lib/libcrypto.so
on the system. So, I can either upgrade libcrypto (brrrr) or downgrade to an older version of NetSNMP... also brrr.
I have tried the yum update process on another Centos 4.3 box, and libcrypto is not upgraded from .4.
Suggestions? Comments? Other options?
Thanks,
Alex
Mike Ayers wrote:
>> From: Alex Moen [mailto:al...@ndtel.com]
>> Sent: Friday, December 28, 2007 6:45 AM
>
>> Now, 3 questions:
>> 1. Should I uninstall (-e) the Net::SNMP stuff I have already
>> installed before compiling and installing Net-SNMP?
>
> I don't think that will be necessary.
>
>> 2. Any particular version of Net-SNMP suggested?
>
> You *must* use the same version of the Net-SNMP perl module as your master agent. As always, latest stable (5.4.1) is suggested.
>
>> 2. Will this affect MRTG? (I think it will not... MRTG seems
>> to be self-contained, but the question bears asking anyway.)
>
> I'm not sure, but I doubt it. SNMP "client"[1] code is usually compiled in.
>
>> Dave Shield wrote:
>
>>> I'm not familiar with CentOS, but assuming it's a reasonably
>>> standard Linux distribution, I would expect it to have the 'locate'
>>> command. What does
>
> CentOS is a popular RedHat derivative.
>
>
> HTH,
>
> Mike
-------------------------------------------------------------------------