1、安装依赖包
#yum install httpd httpd-devel php openssl-devel
#yum install gcc glibc glibc-common
#yum install gd gd-devel
2、创建用户组
#groupadd nagcmd /*建立组nagcmd*/
#usermod -G nagcmd apache /*添加用户apache到组nagcmd*/
#useradd -G nagcmd nagios /*新建用户nagios并添加到组nagcmd*/
#passwd nagios /*修改nagios密码*/
3、下载nagios和插件
#wget http://sourceforge.net/projects/nagios-cn/files/sourcecode/zh_CN%203.2.3/nagios-cn-3.2.3.tar.bz2 ##中文版
#wget http://iweb.dl.sourceforge.net/project/nagiosplug/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz
4、编译安装nagios
#tar -jxvf nagios-cn-3.2.3.tar.bz2
#cd nagios-cn-3.2.3
#./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagcmd ##把nagcmd更改为之前所创建的组。
#make all
#make install
#make install-init
#make install-config
#make install-commandmode
修改联系人为下一步中的管理员并更改email地址
#vi /usr/local/nagios/etc/objects/contacts.cfg
配置web接口
#make install-webconf
Web接口创建nagiosadmin帐号
#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
#设置管理员密码
#service httpd restart
5、安装插件
#cd ~/downloads
#tar xzf nagios-plugins-1.4.16.tar.gz
#cd nagios-plugins-1.4.16
#./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagcmd
#make
#make install
6、启动nagios
#chkconfig --add nagios
#chkconfig nagios on
#chkconfig httpd on
#service httpd restart
#service nagios restart
7、检查nagios配置
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
8、登陆nagios
http://ip:端口/nagios/