天天看点

The scripts outputs "Can't locate Net/SNMP.pm in @

Q:

<a href="http://www.itnms.net/discuz/misc.php?action=viewratings&amp;tid=973&amp;pid=3353"></a>

Can't locate Net/SNMP.pm in @INC....."

[root@nagios libexec]# . /check_snmp_int.pl  -H 192.168.0.1 -C public -n eth

Can't locate Net/SNMP.pm in @INC (@INC contains: /usr b/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr b/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr b/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr b/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr b/perl5/site_perl/5.8.8 /usr b/perl5/site_perl/5.8.7 /usr b/perl5/site_perl/5.8.6 /usr b/perl5/site_perl/5.8.5 /usr b/perl5/site_perl /usr b/perl5 endor_perl/5.8.8/i386-linux-thread-multi /usr b/perl5 endor_perl/5.8.7/i386-linux-thread-multi /usr b/perl5 endor_perl/5.8.6/i386-linux-thread-multi /usr b/perl5 endor_perl/5.8.5/i386-linux-thread-multi /usr b/perl5 endor_perl/5.8.8 /usr b/perl5 endor_perl/5.8.7 /usr b/perl5 endor_perl/5.8.6 /usr b/perl5 endor_perl/5.8.5 /usr b/perl5 endor_perl /usr b/perl5/5.8.8/i386-linux-thread-multi /usr b/perl5/5.8.8 .) at . eck_snmp_int.pl line 16.

BEGIN failed--compilation aborted at . eck_snmp_int.pl line 16.

[root@nagios libexec]#

A:

The scripts outputs "Can't locate Net/SNMP.pm in @INC....."

You don't have Net::SNMP installed, see below

How do I install Net::SNMP perl module ?

There are 2 ways of doing this

1) By CPAN (best)

on command line, as root :

[your_host]# perl -MCPAN -e shell

cpan shell -- CPAN exploration and modules installation (v1.76)

ReadLine support enabled

cpan&gt; install Net::SNMP

If it's the first time you run CPAN, it will probably ask you some (simple) questions.

CPAN will also ask you to satisfy some dependencies (Crypt::DES, Digest::MD5, etc..).

2) "By hand"

- Crypt::DES

- Digest::MD5

- Digest::SHA1

- Digest::HMAC

- Net::SNMP

for each one (you must install Net::SNMP at the end) :

tar zxf .tar.gz

cd

perl Makefile.pl

make test

make install