Can't locate CPAN.pm in @INC

使用nagios监控时日志报错

No output on stdout) stderr: Can't locate Net/SNMP.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/nagios/libexec/check_snmp_storage.pl line 15.

网上资料

How do I install Net::SNMP               perl module ?            There are 2 ways of doing this 
            By CPAN (best) 
            on command line, as root : 
              # perl -MCPAN -e shell 
              cpan shell -- CPAN exploration and modules installation (v1.76)
              ReadLine support enabled
              cpan> 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..).

注:使用perl -MCPAN -e shell也会报错,stderr: Can't locate Net/SNMP.pm in @INC

再次查找资料缺少perl-CPAN,

#yum install perl-CPAN 

解决问题,运行perl -MCPAN -e shell,一路回车最后输入cpan镜像地址

ftp://freesoft.cgi.gov.cn/pub/languages/perl/CPAN 或者

ftp://ftp.cuhk.edu.hk/pub/packages/perl/CPAN/       

依次安装 

install Crypt::DES

install Digest::MD5

install Digest::SHA1
 install Digest::HMAC
 install  Net::SNMP
  也可以从http://www.cpan.org/modules/by-module/

下载以上模块手动安装格式如下:
              tar zxf <module>.tar.gz
              cd <module>
              perl Makefile.pl
              make test
              make install
 


net-snmp安装后无法使用snmpwalk命令?

rpm -qa |grep snmp    确认以下软件是否安装

net-snmp-libs

net-snmp-utils

net-snmp-devel

net-snmp-snmp

你可能感兴趣的:(command,local,share,网上)