十年網(wǎng)站開(kāi)發(fā)經(jīng)驗(yàn) + 多家企業(yè)客戶 + 靠譜的建站團(tuán)隊(duì)
量身定制 + 運(yùn)營(yíng)維護(hù)+專業(yè)推廣+無(wú)憂售后,網(wǎng)站問(wèn)題一站解決
有的時(shí)候監(jiān)控CPU內(nèi)存使用率的情況時(shí),nagios自身多帶的插件有一些缺陷。
在新邵等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站、成都外貿(mào)網(wǎng)站建設(shè)公司 網(wǎng)站設(shè)計(jì)制作按需求定制網(wǎng)站,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),高端網(wǎng)站設(shè)計(jì),成都全網(wǎng)營(yíng)銷,外貿(mào)網(wǎng)站制作,新邵網(wǎng)站建設(shè)費(fèi)用合理。
我們下面使用check_linux_stats.pl這個(gè)perl腳本來(lái)監(jiān)控系統(tǒng)運(yùn)行的一些參數(shù)。
我們到https://exchange.nagios.org/directory/Plugins/Operating-Systems/Linux/check_linux_stats/details上下載check_linux_stats.pl插件,把插件放到nagios的libexec的目錄里。
同時(shí),我們還需要安裝Perl插件,下載地址是http://search.cpan.org/CPAN/authors/id/B/BL/BLOONIX/Sys-Statistics-Linux-0.66.tar.gz
執(zhí)行安裝:
tar -zxvf Sys-Statistics-Linux-0.66.tar.gz
cd Sys-Statistics-Linux-0.66
ls
less INSTALL
perl Makefile.PL#報(bào)錯(cuò)如下
Can't locate ExtUtils/MakeMaker.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 Makefile.PL line 1.
BEGIN failed--compilation aborted at Makefile.PL line 1.
解決方法
安裝perl-UNIVERSAL-require-0.13-1.el6.rf.noarch.rpm
rpm -ivh perl-UNIVERSAL-require-0.13-1.el6.rf.noarch.rpm
還是報(bào)錯(cuò)
Can't locate ExtUtils/MakeMaker.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 Makefile.PL line 1.
BEGIN failed--compilation aborted at Makefile.PL line 1.
解決方法
yum install -y perl-devel
然后執(zhí)行安裝
perl Makefile.PL
make
make test#執(zhí)行該命令可能會(huì)報(bào)錯(cuò),不用管
make install
執(zhí)行/usr/local/nagios/libexec/check_linux_stats.pl,又報(bào)錯(cuò):
Can't locate Time/HiRes.pm in @INC (@INC contains: /usr/local/nagios/libexec /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/share/perl5/Sys/Statistics/Linux/Processes.pm line 177.
BEGIN failed--compilation aborted at /usr/local/share/perl5/Sys/Statistics/Linux/Processes.pm line 177.
Compilation failed in require at ./check_linux_stats.pl line 34.
BEGIN failed--compilation aborted at ./check_linux_stats.pl line 34.
解決方法
yum -y install perl-Time-HiRes
然后執(zhí)行:
./check_linux_stats.pl --help
check_linux_stats v1.3.1
Usage: ./check_linux_stats.pl -C|-P|-M|-N|-D|-I|-L|-F|-S|-W|-U -p
-h, --help
print this help message
-C, --cpu=CPU USAGE
-P, --procs
-M, --memory=MEMORY USAGE
-N, --network=NETWORK USAGE
-D, --disk=DISK USAGE
-I, --io=DISK IO USAGE
-L, --load=LOAD AVERAGE
-F, --file=FILE STATS
-S, --socket=SOCKET STATS
-W, --paging=PAGING AND SWAPPING STATS
-U, --uptime
-p, --pattern
eth0,eth2...sda1,sda2.../usr,/tmp
-w, --warning
-c, --critical
-s, --sleep
-u, --unit
%, KB, MB or GB left on disk usage, default : MB
REQS OR BYTES on disk io statistics, default : REQS
-V, --version
version number
ex :
Memory usage : perl check_linux_stats.pl -M -w 90 -c 95
Cpu usage : perl check_linux_stats.pl -C -w 90 -c 95 -s 5
Disk usage : perl check_linux_stats.pl -D -w 95 -c 100 -u % -p /tmp,/usr,/var
Load average : perl check_linux_stats.pl -L -w 10,8,5 -c 20,18,15
Paging statistics : perl check_linux_stats.pl -W -w 10,1000 -c 20,2000 -s 3
Process statistics : perl check_linux_stats.pl -P -w 100 -c 200
I/O statistics on disk device : perl check_linux_stats.pl -I -w 10 -c 5 -p sda1,sda4,sda5,sda6
Network usage : perl check_linux_stats.pl -N -w 10000 -c 100000000 -p eth0
Processes virtual memory : perl check_linux_stats.pl -T -w 9551820 -c 9551890 -p /var/run/sendmail.pid
Uptime : perl check_linux_stats.pl -U -w 5
運(yùn)行正常!