首页 > 代码库 > Cacti+Nagios监控系统(三):安装Nagios
Cacti+Nagios监控系统(三):安装Nagios
一、添加用户
groupadd nagcmd
useradd -G nagcmd nagios
passwd nagios
123456
usermod -a -G nagcmd apache
二、安装nagios
cd /root/download
wget http://jaist.dl.sourceforge.net/project/nagios/nagios-4.x/nagios-4.0.7/nagios-4.0.7.tar.gz
也可以从这里下载:http://www.nagios.org/download/
tar xzvf nagios-4.0.7.tar.gz
cd nagios-4.0.7
./configure --with-command-group=nagcmd --enable-event-broker
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
设置登陆web界面时HTTP验证的账号密码
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
service httpd restart
三、安装nagios-plugins
cd /root/download
wget http://nagios-plugins.org/download/nagios-plugins-2.0.2.tar.gz
tar xzvf nagios-plugins-2.0.2.tar.gz
cd nagios-plugins-2.0.2
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-mysql
make
make install
所有插件命令将被安装到/usr/local/nagios/libexec 目录下
四、其他设置
1、检测nagios的配置
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
2、添加自动动项
chkconfig --add nagios
chkconfig nagios on
service nagios start
3、登陆页面
http://localhost/nagios
账号nagiosadmin密码123456
五、遇到的问题
点击页面左侧的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
本文出自 “月晴星飞” 博客,请务必保留此出处http://ywzhou.blog.51cto.com/2785388/1531926