Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1605957
  • 博文数量: 184
  • 博客积分: 3044
  • 博客等级: 中校
  • 技术积分: 2467
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-25 15:04
文章分类

全部博文(184)

文章存档

2022年(4)

2021年(3)

2020年(1)

2019年(5)

2018年(13)

2017年(6)

2016年(10)

2015年(11)

2014年(11)

2013年(13)

2012年(23)

2011年(25)

2010年(2)

2008年(1)

2007年(5)

2006年(51)

分类: LINUX

2014-10-01 17:08:35

系统:centos6.4
需要安装的东西:php,spawn-fcgin,nginx1.6 nagios4.0.8
下载好:
nagios-4.0.8.tar.gz          nagvis-1.7.10.tar.gz  php-5.3.8.tar.gz
nagios-plugins-2.0.3.tar.gz  nginx-1.6.0.tar.gz    pnp4nagios-0.6.24.tar.gz

1:yum install gd gcc pcre* zlib-devel perl-FCGI

2:安装好php,nginx1.6

3: 安装nagios
#### installnagios.sh####
 tar -xvf nagios-4.0.8.tar.gz
  cd nagios-4.0.8
  useradd nagios
  groupadd nagcmd
  usermod -G nagcmd nagios
  usermod -G nagcmd www
  ./configure --with-command-group=nagcmd --prefix=/kingdee/nagios --with-nagios-user=nagios --with-nagios-group=nagios
  make all
  make install
 make install-init
  make install-config
  make install-commandmode
cd ..
tar -xvf nagios-plugins-2.0.3.tar.gz
cd nagios-plugins-2.0.3
./configure --with-command-group=nagcmd --prefix=/kingdee/nagios --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
ln /kingdee/nagios/share /kingdee/www/nagios/nagios

Nginx设置


点击(此处)折叠或打开

  1. listen 80;
  2.         server_name localhost;
  3.         root /kingdee/www/nagios/nagios;
  4.         location ~ .*\.(pl|cgi)?$
  5.                 {
  6.                 root /kingdee/nagios/sbin;
  7.                 rewrite ^/nagios/cgi-bin/(.*).cgi /$1.cgi break;
  8.                 fastcgi_pass unix:/tmp/perl-fastcgi.sock;
  9.                 fastcgi_index index.cgi;
  10.                 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  11.                 include fastcgi_params;
  12.                fastcgi_param REMOTE_USER $remote_user;
  13.                 auth _basic "Nagios Access";
  14.                 auth_basic_user_file /kingdee/nginx/conf/nagiospasswd;
  15.                 }

  16.         location /nagios {
  17.             root /kingdee/www/nagios/;
  18.             index index.php;
  19.         }


  20.         location ~ .*\.(php|php5)?$
  21.                         {
  22.                                 fastcgi_pass unix:/var/run/php-fcgi.sock;
  23.                                 fastcgi_index index.php;
  24.                                 include fastcgi.conf;
  25.                         }
其中
                fastcgi_param  REMOTE_USER        $remote_user;
                auth_basic "Nagios Access";
                auth_basic_user_file /kingdee/nginx/conf/nagiospasswd;
可以解决etc/cgi.cfg中nagiosadmin的认证问题(前提要开启nginx的认证,用户为:nagiosadmin)
php采用:fastcgi_pass unix:/var/run/php-fcgi.sock
好像可以提高性能!没有详细测试


另:

在设置spawn-fcgi的启动配置文件:/etc/sysconfig/spawn-fcgi
#####
SOCKET=/tmp/php-fcgi.sock
#OPTIONS="-u apache -g apache -s $SOCKET -S -M 0600 -C 32 -F 1 -P /var/run/spawn-fcgi.pid -- /usr/bin/php-cgi"
OPTIONS="-u nagios -g nagios -s $SOCKET -S -M 0600 -C 32 -F 1 -P /var/run/spawn-fcgi.pid -- /usr/bin/php-cgi"
#####
这时可以启动nagios、spawn-fcgi、nginx 时应该 可以在进行nagios的正常访问!

阅读(3083) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~