1、下载nagios-4.0.8、nagios-plugins-2.0.3

wgethttp://jaist.dl.sourceforge.net/project/nagios/nagios-4.x/nagios-4.0.8/nagios-4.0.8.tar.gz

wgethttp://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz

2、安装组件

yum install -y wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp

3、创建nagios用户与用户组

useradd nagios

groupadd nagcmd

usermod -a -G nagcmd nagios

4、安装nagios-4.0.8

tar zxvf nagios-4.0.8.tar.gz

cd nagios-4.0.8

./configure --prefix=/usr/local/nagios --with-command-group=nagcmd--with-nagios-group=nagcmd

make all

make install

make install-init

make install-config

make install-commandmode

make install-webconf

cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/

chown -R nagios:nagcmd /usr/local/nagios/libexec/eventhandlers

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

service nagios start

5、配置httpd

1)配置web登陆用户名和密码

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

vi /etc/httpd/conf/httpd.conf 加入以下内容


2)找到

user apache

group apache

修改为

user nagios

group nagcmd

3)找到

#ServerName www.example.com:80

将前面的#删除

6、安装nagios-plugins

tar zxvf nagios-plugins-2.0.3.tar.gz

cd nagios-plugins-2.0.3

./configure --prefix=/usr/local/nagios--with-nagios-user=nagios --with-nagios-group=nagcmd--with-command-user=nagios--with-command-group=nagcmd

make

make install

7、设置开机启动

chkconfig nagios on

service nagios start

chkconfig httpd on

service httpd start

8、访问

http://IP/nagios输入用户名密码

nagiosadmin:$apr1$CZJUFBRq$TBWA4x8B6nbH0nA4ekHg7. http://tool.oschina.net/htpasswd