Nginx下构建Nagios监控平台Nagios+nrpe+nagios-plugins+pnp安装
Nginx下构建Nagios监控平台Nagios+nrpe+nagios-plugins+pnp安装文档
系统环境:CentOS release 5.8 x86_64
一:监控端安装
1,安装perl模块:
(1)、先安装FCGI模块
- wget http://search.cpan.org/CPAN/authors/id/F/FL/FLORA/FCGI-0.73.tar.gz
- tar xvzf FCGI-0.73.tar.gz
- cd FCGI-0.73
- perl Makefile.PL
- make
- make install
(2)、安装FCGI-ProcManager模块
- wget http://mirrors.ustc.edu.cn/CPAN/authors/id/B/BO/BOBTFISH/FCGI-ProcManager-0.24.tar.gz
- tar xvzf FCGI-ProcManager-0.19.tar.gz
- cd FCGI-ProcManager-0.19
- perl Makefile.PL
- make
- make install
(3)、安装IO和IO::ALL模块
- wget http://search.cpan.org/CPAN/authors/id/G/GB/GBARR/IO-1.25.tar.gz
- tar zxvf IO-1.25.tar.gz
- cd IO-1.25
- perl Makefile.PL
- make
- make install
- wget http://mirrors.xmu.edu.cn/CPAN/authors/id/I/IN/INGY/IO-All-0.44.tar.gz
- tar zxvf IO-All-0.41.tar.gz
- cd IO-All-0.41
- perl Makefile.PL
- make
- make install
(4)、下载Perl脚本
这个脚本的目的就是产生一个PERL的FastCGI接口,让Nginx可以以CGI方式处理Perl。注:建议把这个脚本放在Nginx安装目录,修改脚本权限为777
- http://www.chlinux.net/perl-fcgi.zip
- unzip perl-fcgi.zip
- cp perl-fcgi.pl /usr/local/nginx/
- chmod 755 /usr/local/nginx/perl-fcgi.pl
(5)、建立一个CGI启动/停止脚本
这个SHELL脚本只是为了方便管理上面的Perl脚本。脚本中的nobody为nginx的运行用户,请据自己的实际情况调整。
注意事项:不能用root用户执行(会提示). 要用与Nginx相同身份的用户执行。否则可能会在Nginx Log中提示 Permision Denied。
- vi /usr/local/nginx/start_perl_cgi.sh
- #!/bin/bash
- #set -x
- dir=/usr/local/ nginx/
- stop ()
- {
- #pkill -f $dir/perl-fcgi.pl
- kill $(cat $dir/logs/perl-fcgi.pid)
- rm $dir/logs/perl-fcgi.pid 2>/dev/null
- rm $dir/logs/perl-fcgi.sock 2>/dev/null
- echo "stop perl-fcgi done"
- }
- start ()
- {
- rm $dir/now_start_perl_fcgi.sh 2>/dev/null
- chown nobody.nobody $dir/logs
- echo "$dir/perl-fcgi.pl -l $dir/logs/perl-fcgi.log -pid $dir/logs/perl-fcgi.pid -S $dir/logs/perl-fcgi.sock" >>$dir/now_start_perl_fcgi.sh
- chown nobody.nobody $dir/now_start_perl_fcgi.sh
- chmod u+x $dir/now_start_perl_fcgi.sh
- sudo -u nobody $dir/now_start_perl_fcgi.sh
- echo "start perl-fcgi done"
- }
- case $1 in
- stop)
- stop
- ;;
- start)
- start
- ;;
- restart)
- stop
- start
- ;;
- esac
修改SHELL脚本权限
chmod 755 /usr/local/nginx/start_perl_cgi.sh
启动脚本
/usr/local/nginx/start_perl_cgi.sh start
正常情况下在/usr/local/nginx/logs下生成perl-fcgi.sock这个文件,如果没有生成,请检查下上面的步聚。
相关推荐
边城客栈学无止境 2020-07-05
Walter的学习笔记 2020-07-04
A宇 2020-06-14
边城客栈学无止境 2020-06-10
邓博学习笔记 2020-06-03
davidliu00 2020-05-26
ShiShuo 2020-05-16
Aggressivesnail 2020-05-10
ShiShuo 2020-04-26
hanxingwang00 2020-04-22
davidliu00 2020-03-06
ShiShuo 2020-03-06
ShiShuo 2020-03-05
Aggressivesnail 2020-02-28
aaLiweipeng 2020-02-01
amberom 2020-01-16
Walter的学习笔记 2020-01-06