在此简单写下nagios的搭建过程,有什么不足之处请指出
监控端的搭建
#wget  http://sourceforge.net/projects/nagios/files/nagios-3.x/nagios-3.2.1/nagios-3.2.1.tar.gz
#tar -xzvf nagios-3.2.1.tar.gz
#useradd nagios -s /sbin/nologin
#cd nagios-3.2.1
#./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios
#make all
#make install
#make install-init
#make install-commandmode
#make install-config
#mkdir /etc/httpd/conf.d/
#make install-webconf
================================

#wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz  //naigos 插件
#tar -xzvf nagios-plugins-1.4.15.tar.gz
#./configure --prefix=/usr/local/nagios/
#make
#make install
===================================

#wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
#tar –xzvf nrpe-2.12.tar.gz
#cd nrpe-2.12
#./configure –enable-ssl
#make all
#make install
#make install-plugin
#make install-daemon
#make install-daemon-config
#make install-xinetd
#vim /etc/services
nrpe     5666/tcp         # nrpe

#cp init-script /etc/init.d/nrpe
#vim /usr/local/nagios/etc/objects/commands.cfg,加入下面的command
define command{ 

       command_name  check_nrpe 

       command_line  $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1 }

----------------------------------------------------
被监控端的搭建
#wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz  //naigos 插件
#tar -xzvf nagios-plugins-1.4.15.tar.gz
#./configure --prefix=/usr/local/nagios/
#make
#make install
===================================

#wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
#tar –xzvf nrpe-2.12.tar.gz
#cd nrpe-2.12
#./configure –enable-ssl
#make all 
#make install 
#make install-plugin  
#make install-daemon 
#make install-daemon-config
#make install-xinetd
#vim /etc/services
nrpe     5666/tcp         # nrpe
================================

添加nagios访问目录(nagios 的安装路径/usr/local/nagios),同时使用http用户验证。把下面的内容追加到httpd.conf文件的末尾:

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>
=============================
做个用户认证
#htpasswd -c /usr/local/nagios/etc/htpasswd nagios

这里只是写下监控端和被监控端的安装步骤,没有做详细的文件解释,下篇文章会详细解释其中的文件含义,并会简单的介绍几个错误的解决方法