搭建基于nginx环境的nagios监控系统 推荐
2012-11-21 18:21
721 查看
搭建基于apache的nagios系统比较容易,网上的资料也比较多。可是在nginx环境下就有点费劲了,因为nginx本身不支持CGI,所以需要在三方程序的配合下,才能实现CGI的解析。
本文只讲述安装部分,有机会再给大家补上配置部分。下面就开始学习在nginx环境下安装,安装nagios监控系统。
准备工作:
下载安装包:
添加相关用户:
开始安装:
编译安装nagios:
编译安装nagios插件:
编译安装nrpe:
安装perl,CGI脚本是用perl实现的:
编译安装perl脚本所需要调用的组件:
下载并配置可是实现CGI解析的脚本:
创建登录nagios的用户账户和密码文件:
配置nginx虚拟主机并重启:
创建软连接:
测试登录:
登录后的界面如下:
注意:文中所涉及到的一部分安装包,下载链接可能会失效。大家请从我的附件下载。
如果大家安装有问题的话,请及时联系我!!
附件:http://down.51cto.com/data/2361810
本文只讲述安装部分,有机会再给大家补上配置部分。下面就开始学习在nginx环境下安装,安装nagios监控系统。
准备工作:
下载安装包:
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz wget http://www.cpan.org/modules/by-module/FCGI/FCGI-0.67.tar.gz wget http://search.cpan.org/CPAN/authors/id/G/GB/GBJK/FCGI-ProcManager-0.18.tar.gz wget http://search.cpan.org/CPAN/authors/id/G/GB/GBARR/IO-1.25.tar.gz wget http://search.cpan.org/CPAN/authors/id/I/IN/INGY/IO-All-0.39.tar.gz
添加相关用户:
groupadd nagios useradd -g nagios nagios
开始安装:
编译安装nagios:
tar zxvf nagios-3.4.1.tar.gz cd nagios ./configure --prefix=/data/app/nagios --with-nagios-user=nagios --with-nagios-group=nagios make all make install make install-init make install-commandmode make install-config cd ..
编译安装nagios插件:
tar zxvf nagios-plugins-1.4.16.tar.gz cd nagios-plugins-1.4.16 ./configure --prefix=/data/app/nagios --with-nagios-user=nagios --with-nagios-group=nagios make make install cd ..
编译安装nrpe:
tar zxvf nrpe-2.13.tar.gz cd nrpe-2.13 ./configure --prefix=/data/app/nagios --with-nrpe-user=nagios --with-nrpe-group=nagios make make install cd ..
安装perl,CGI脚本是用perl实现的:
yum install perl
编译安装perl脚本所需要调用的组件:
tar zxvf FCGI-0.67.tar.gz cd FCGI-0.67 perl Makefile.PL make make install cd .. tar zxvf FCGI-ProcManager-0.18.tar.gz cd FCGI-ProcManager-0.18 perl Makefile.PL make make install cd .. tar zxvf IO-1.25.tar.gz cd IO-1.25 perl Makefile.PL make make install tar zxvf IO-All-0.39.tar.gz cd IO-All-0.39 perl Makefile.PL make make install
下载并配置可是实现CGI解析的脚本:
cd /data/app/nginx/sbin/ wget http://www.linux8080.com/perl-fcgi.pl chmod +x perl-fcgi.pl chown nginx.nginx perl-fcgi.pl /data/app/nginx/sbin/perl-fcgi.pl -pid /var/run/nginx-fcgi.pid -S /var/run/nginx-fcgi.sock -l /var/log/perl-fcgi.log cd /var/run chmod 777 nginx-fcgi.sock
创建登录nagios的用户账户和密码文件:
cd /data/app/nagios/etc/ htpasswd -c htpasswd nagios
配置nginx虚拟主机并重启:
server { listen 80; server_name 10.10.10.200; index index.html index.htm index.php; root /data/www/html; location ~ .*\.(cgi|pl)?$ { gzip off; root /data/app/nagios/sbin; rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break; fastcgi_pass unix:/var/run/nginx-fcgi.sock; fastcgi_param SCRIPT_FILENAME /data/app/nagios/sbin$fastcgi_script_name; fastcgi_index index.cgi; fastcgi_read_timeout 60; fastcgi_param REMOTE_USER $remote_user; include fcgi.conf; } location ~ ^/nagios/.+\.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fcgi.conf; auth_basic "Nagios Access"; auth_basic_user_file /data/app/nagios/etc/htpasswd; } }
创建软连接:
ln -s /data/app/nagios/share /data/www/html/nagios
测试登录:
登录后的界面如下:
注意:文中所涉及到的一部分安装包,下载链接可能会失效。大家请从我的附件下载。
如果大家安装有问题的话,请及时联系我!!
附件:http://down.51cto.com/data/2361810
相关文章推荐
- 搭建基于nginx环境的nagios监控系统
- Cacti监控服务器配置教程(基于CentOS+Nginx+MySQL+PHP环境搭建)
- 搭建基于Nagios的监控系统——之监控远程Windows服务器
- 搭建基于Nagios的监控系统——之监控远程Linux服务器
- Nginx配置多个基于域名的虚拟主机+实验环境搭建+测试 推荐
- 生产环境监控系统Nginx+Nagios+Cacti+Nconf大整合(最新源码安装)【转载】
- 一键搭建nagios监控系统之一 脚本篇 推荐
- 搭建基于Nagios的监控系统——之安装Nagios Core
- Cacti监控服务器配置教程(基于CentOS+Nginx+MySQL+PHP环境搭建)
- 搭建基于Nagios的监控系统——之监控远程Linux服务器
- 搭建基于Nagios的监控系统——之监控远程Windows服务器
- 基于Nginx平台部署Nagios监控系统
- Cacti监控服务器配置教程(基于CentOS+Nginx+MySQL+PHP环境搭建)
- Nginx平台安装Nagios监控服务(0608更新) 推荐
- Android系统开发环境搭建(基于CentOS) -- 1
- PIXHAWK开发环境搭建(基于Ubuntu14.04系统)
- 基于fedora16的nagios环境搭建--个人日记(7)--php反思
- 基于CentOS6.5下Suricata(一款高性能的网络IDS、IPS和网络安全监控引擎)的搭建(图文详解)(博主推荐)
- 一键搭建nagios监控系统之三 测试篇
- Linux下nginx+nagios 监控平台搭建