1、添加用户123[root@nagios ~]# groupadd nagcmd[root@nagios ~]# useradd -G nagcmd nagios[root@nagios ~]# usermod -a -G nagcmd apache
2、安装nagios官方下载地址:http://www.nagios.org/download/1234567891011[root@nagios ~]# cd /home/nagios[root@nagios nagios]# wget http://jaist.dl.sourceforge.net/project/nagios/nagios-4.x/nagios-4.0.7/nagios-4.0.7.tar.gz
[root@nagios nagios]# tar xzvf nagios-4.0.7.tar.gz[root@nagios nagios]# cd nagios-4.0.7[root@nagios nagios-4.0.7]# ./configure –with-command-group=nagcmd –enable-event-broker
[root@nagios nagios-4.0.7]#make all[root@nagios nagios-4.0.7]#make install[root@nagios nagios-4.0.7]#make install-init
[root@nagios nagios-4.0.7]#make install-config[root@nagios nagios-4.0.7]#make install-commandmode[root@nagios nagios-4.0.7]#make install-webconf
设置登陆web界面时HTTP验证的账号密码12[root@nagios nagios-4.0.7]#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
[root@nagios nagios-4.0.7]#service httpd restart3、安装nagios-plugins1234567[root@nagios nagios-4.0.7]#cd /home/nagios
[root@nagios nagios]# wget http://nagios-plugins.org/download/nagios-plugins-2.0.2.tar.gz[root@nagios nagios]# tar xzvf nagios-plugins-2.0.2.tar.gz
[root@nagios nagios]# cd nagios-plugins-2.0.2[root@nagios nagios-plugins-2.0.2]# ./configure –with-nagios-user=nagios –with-nagios-group=nagios –with-mysql
[root@nagios nagios-plugins-2.0.2]# make[root@nagios nagios-plugins-2.0.2]# make install所有插件命令将被安装到/usr/local/nagios/libexec 目录下
4、其他设置检查nagios的配置:1[root@nagios ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg添加自动动项:
123[root@nagios ~]# chkconfig –add nagios[root@nagios ~]# chkconfig nagios on[root@nagios ~]# service nagios start
登陆页面:http://localhost/nagios账号nagiosadmin密码1234565、遇到的问题点击页面左侧的MAP和History报错:12The requested URL /nagios/sbin/statusmap.cgi was not found on this server.
The requested URL /nagios/sbin/histogram.cgi was not found on this server.原因一:因为gd-devel php-gd没有安装的问题,造成NAGIOS在编译时不生成这statusmap.cgi
原因二:nagios编译在前, gd-devel安装在后,造成不生成这statusmap.cgi解决方法:yum安装gd-devel php-gd,再重新编译安装nagios