nagios

目录

nagios

安装
1.准备工作

yum install -y gcc glibc glibc-common gd gd-devel xinetd openssl-devel
yum install perl

useradd -s /sbin/nologin nagios
mkdir /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios


2.编译安装Nagios
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.3.tar.gz
tar zxvf nagios-3.4.3.tar.gz
cd nagios
./configure --prefix=/usr/local/nagios

make all
make install
make install-init
make install-commandmode
make install-config

chkconfig --add nagios
chkconfig --level 35 nagios on
chkconfig --list nagios

3.安装Nagios 插件
wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz
tar zxvf nagios-plugins-2.0.tar.gz
cd nagios-plugins-2.0
./configure --prefix=/usr/local/nagios
make
make install 

4.安装Apache
wget http://archive.apache.org/dist/httpd/httpd-2.2.23.tar.gz
tar zxvf httpd-2.2.23.tar.gz
cd httpd-2.2.23
./configure --prefix=/usr/local/webserver/apache2
make && make install

5.安装php
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype \
freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel \
bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 \
krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap \
openldap-clients openldap-servers perl perl-devel libc-client-devel


wget http://ar2.php.net/get/php-5.4.27.tar.gz/from/this/mirror
mv mirror php-5.4.27.tar.gz
tar xvf php-5.4.27.tar.gz
cd php-5.4.27
./configure --prefix=/usr/local/webserver/php5427 --with-apxs2=/usr/local/webserver/apache2/bin/apxs
make
make install


6.配置apache
vim /usr/local/webserver/apache2/conf/httpd.conf
 User nagios
 Group nagios

 <IfModule dir_module> 
   DirectoryIndex index.html index.php 
 </IfModule> 

 AddType application/x-httpd-php .php 
 #setting for nagios 
 ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin" 
 <Directory "/usr/local/nagios/sbin"> 
      AuthType Basic 
      Options ExecCGI 
      AllowOverride None 
      Order allow,deny 
      Allow from all 
      AuthName "Nagios Access" 
      AuthUserFile /usr/local/nagios/etc/htpasswd             #用于此目录访问身份验证的文件 
      Require valid-user 
 </Directory> 
 Alias /nagios "/usr/local/nagios/share" 
 <Directory "/usr/local/nagios/share"> 
      AuthType Basic 
      Options None 
      AllowOverride None 
      Order allow,deny 
      Allow from all 
      AuthName "nagios Access" 
      AuthUserFile /usr/local/nagios/etc/htpasswd 
      Require valid-user 
 </Directory> 
/usr/local/webserver/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd jimila

7.启动apache
/usr/local/webserver/apache2/bin/apachectl start




目录