Cacti+Nagios(三):安装Nagios
1、添加用户
为梅县等地区用户提供了全套网页设计制作服务,及梅县网站建设行业解决方案。主营业务为成都网站制作、成都网站设计、梅县网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
[root@nagios ~]# groupadd nagcmd [root@nagios ~]# useradd -G nagcmd nagios [root@nagios ~]# usermod -a -G nagcmd apache
2、安装nagios
官方下载地址:http://www.nagios.org/download/
[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验证的账号密码
[root@nagios nagios-4.0.7]#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin [root@nagios nagios-4.0.7]#service httpd restart
3、安装nagios-plugins
[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的配置:
[root@nagios ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
添加自动动项:
[root@nagios ~]# chkconfig --add nagios [root@nagios ~]# chkconfig nagios on [root@nagios ~]# service nagios start
登陆页面:
http://localhost/nagios
账号nagiosadmin密码123456
5、遇到的问题
点击页面左侧的MAP和History报错:
The 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
网页题目:Cacti+Nagios(三):安装Nagios
网站地址:http://hbruida.cn/article/giejdc.html