nagios监控解决Perl脚本问题-创新互联

[root@test download]# ./check_memory.pl

涪城网站制作公司哪家好,找创新互联建站!从网页设计、网站建设、微信开发、APP开发、响应式网站设计等网站项目制作,到程序开发,运营维护。创新互联建站自2013年创立以来到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联建站

Can't locate Nagios/Plugin.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 ./check_memory.pl line 26.

BEGIN failed--compilation aborted at ./check_memory.pl line 26.

解决:

[root@test download]# perl -MCPAN -e 'install Nagios::Plugin'

[root@test download]# ./check_memory.pl

CHECK_MEMORY OK - 1589M free | free=1666281472b;;

[root@test download]#

或者

cpan -i Nagios::Plugin

第一次安装如果中间有报:

Do you want to modify/update your configuration (y|n) ? [no] no

这里提示要不要对原有网络配置进行更新修改,我们选择no

Shall I follow them and prepend them to the queue of modules we are processing right now? [yes] yes

这里提示须跟随他们和他们预队列中我们现在正在处理的模块吗,直接输入yes.

好了,下面就是等待了,可能会有上面几次的重复提示,都安装上吧,安装完后,出现

cpan>

输入exit退出.

===================================

[root@web-server1 download]# perl -MCPAN -e 'install Nagios::Plugin'

Can't locate CPAN.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 .).

BEGIN failed--compilation aborted.

解决:

wget http://search.cpan.org/CPAN/authors/id/A/AN/ANDK/CPAN-1.9800.tar.gz

解压后执行:

perl Makefile.PL && make && make install

==================================================

Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains

解决:

wget http://search.cpan.org/CPAN/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.54.tar.gz

解压后执行:

perl Makefile.PL && make && make install

==================================

Can't locate Time/HiRes.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 /gitecroot/download/CPAN-1.9800) at /usr/share/perl5/Net/Ping.pm line 313.

解决:

yum install perl-Time-HiRes

======================================

make装好了却编译时报错:

make: *** No rule to make target `/usr/lib/perl5/CORE/config.h',needed by `Makefile'. Stop.

解决:

yum install -y perl-devel

=====================================

Can't locate local/lib.pm in @INC

执行命令:cpan -i Nagios::Plugin

perl -MCPAN -e 'install Nagios::Plugin'

如果没有安装成功,查看屏幕报错:Can't locate Params/Validate.pm in @INC

================================

Can't locate Params/Validate.pm in @INC

yum install perl-Params-Validate

yum install perl-DateTime

==================================

Can't locate Regexp/Common.pm in @INC

cpan -i Regexp::Common

==================================

Can't locate Test/More.pm

cpan -i Test::More

=================================

XML-Parser模块安装

yum install gcc -y

yum install expat-devel  -y

wget http://search.cpan.org/CPAN/authors/id/M/MS/MSERGEANT/XML-Parser-2.34.tar.gz

tar zxf XML-Parser-2.34.tar.gz

cd XML-Parser-2.34

perl Makefile.PL  && make && make install

================

XML-Simple模块安装

perl -MCPAN -e "install XML::Simple"

===================

yum install perl-CPAN

[root@wgq_line_cache_3_41 plugins]# ./check_redis.pl --help

Can't locate Redis.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 ./check_redis.pl line 421.

BEGIN failed--compilation aborted at ./check_redis.pl line 421.

[root@wgq_line_cache_3_41 plugins]#

[root@wgq_line_cache_3_41 plugins]# perl -MCPAN -e shell

Terminal does not support AddHistory.

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

Enter 'h' for help.

cpan[1]> install Redis

Can't locate Module/Build/Tiny.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 Build.PL line 2.

BEGIN failed--compilation aborted at Build.PL line 2.

Warning: No success on command[/usr/bin/perl Build.PL --installdirs site]

Warning (usually harmless): 'YAML' not installed, will not store persistent state

 DAMS/Redis-1.976.tar.gz

 /usr/bin/perl Build.PL --installdirs site -- NOT OK

Running Build test

 Make had some problems, won't test

Running Build install

 Make had some problems, won't install

Could not read '/root/.cpan/build/Redis-1.976-Zhz6xI/META.yml'. Falling back to other methods to determine prerequisites……

YAML是以数据为中央的标记语言,其使用ASCII码(如连字符、问号、冒号、逗号等)构造数据块(标量值或哈希码)。和XML相同,YAML也是一种机器可识别语言,并能和多种脚本语言相结合,其中一种便是Perl,需要安装YAML,如下执行:

cpan[2]>install YAML

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网站名称:nagios监控解决Perl脚本问题-创新互联
新闻来源:http://hbruida.cn/article/decihe.html