一、Nagios简介
Nagios是一个监视系统运行状态和网络信息的监视系统。Nagios能监视所指定的本地或远程主机以及服务,同时提供异常通知功能等。
Nagios可运行在Linux/Unix平台之上,同时提供一个可选的基于浏览器的WEB界面以方便系统管理人员查看网络状态,各种系统问题,以及日志等等。
二、安装准备阶段
nagios搭建在centos5.5上,nagios需要一些基础支持套件才能运行,如apache,gcc,glibc,gd库等。添加nagios用户和组,用来运行nagios
三、Nagios服务端安装
#yum install libgd libgd-devel libpng libpng-devel libjpeg libjpeg-devel zlib zlib-devel gd-devel
#groupadd nagios
#useradd -g nagios nagios -s /sbin/nologin
#usermod -a -G nagios daemon --将运行apache用户daemon加入nagios组
#tar zxvf nagios-3.3.1.tar.gz
#cd nagios/
#./configure --prefix=/usr/local/nagios --with-gd-lib=/usr/lib --with-gd-inc=/usr/include
#make all
#make install
#make install-cgis
#make install-init
#make install-config
#make install-commandmode
#make install-webconf
#htpasswd -c /usr/local/nagios/etc/htpasswd.users admin --设置网页登录用户名,输入密码
#vi /etc/httpd/conf/httpd.conf
添加如下内容
Include conf/extra/nagios.conf
#/etc/init.d/httpd restart
四、安装nagios插件
1、安装nagios-plugins插件
#tar zxvf nagios-plugins-1.4.15.tar.gz
#cd nagios-plugins-1.4.15
#./configure --with-nagios-user=nagios --with-nagios-group=nagios
#make
#make install
#tar zxvf nrpe-2.13.tar.gz
2、安装nrpe插件
#cd nrpe-2.13
#./configure --enable-ssl --enable-command-args
#make all
#make install-plugin
#make install-daemon
#make install-daemon-config
#make install-xinetd
3、在/usr/local/nagios/etc/objects/commands.cfg中加入以下内容
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
五、启动nagios
/etc/init.d/nagios restart
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
六、安装错误解决
点击Event Log,提示It appears as though you do not have permission to view the log file...
#vi /usr/local/nagios/etc/cgi.cfg
use_authentication=1 #把1修改为0,保存
#/etc/init.d/nagios restart