[Nagios监控] CentOS 6.2安装配置Nagios Server

1> 安装软件包

yum install  httpd gcc glibc glibc-common php  gd  gd-devel libpng  libmng libjpeg zlib -y

yum install openssl openssl-devel -y

2> 配置php环境

vim /etc/httpd/conf/httpd.conf

276 ServerName localhost:80

3> 创建nagios帐号

useradd  nagios

groupadd nagcmd

usermod -G nagcmd  nagios

usermod -G nagcmd  apache

4> 安装nagios-3.4.1

a> 下载软件包,解压编译

wget ftp://192.168.68.254/monitor/nagios/nagios-3.4.1.tar.gz

tar -zxvf nagios-3.4.1.tar.gz

cd nagios

./configure --with-command-group=nagcmd

make all && make install

make install-init && make install-config && make install-commandmode && make install-webconf

b> 创建用户用于Nagios的WEB接口登录,重启httpd使配置生效

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

service httpd restart

5> 编译并安装Nagios插件

wget ftp://192.168.68.254/monitor/nagios/nagios-plugins-1.4.16.tar.gz

tar -zxvf nagios-plugins-1.4.16.tar.gz

cd nagios-plugins-1.4.16

./configure --with-nagios-user=nagios --with-nagios-group=nagcmd

make && make install

6> 验证nagios样例配置文件

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

7> 启动nagios服务

service nagios start

service httpd start