这是我在线上部署参考的文档,期间遇到各种问题,比如nagios为off状态,没有数据显示等等,最后和百度大神一起都一一解决了,
Nagios+Cacti+Nconf
系统:CentOS5.8-x86_64
安装前的准备工作
yum install -y httpd-* mysql-* php-* net-snmp* gcc glibc glibc-common gd gd-devel
一、nagios 环境的搭建
1.安装nagios
wget http://sourceforge.net/projects/nagios/files/nagios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz
useradd nagios
tar zxf nagios-3.3.1.tar.gz
cd nagios
./configure -prefix=/var/www/html/nagios
make all
make install && make install-init && make install-commandmode && make install-config && make install-webconf
2.增加nagios登陆认证文件,一定要用默认的nagiosadmin作为用户,否则需要修改其他文件。
htpasswd -c /var/www/html/nagios/etc/htpasswd.users nagiosadmin
3. 安装插件:
wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz
tar -zvxf nagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15
./configure -prefix=/var/www/html/nagios/
make
make install
4.将运行Apache的用户添加到nagios组里,这样Apache才有权限读取文件
usermod -G nagios apache ##将apache用户加到nagios组。
5.阶段测试
chown nagios.nagios /var/www/html/nagios/ -R
service httpd restart
chkconfig httpd on
/etc/init.d/nagios start
二:cacti环境的搭建
1.rrdtool的安装,
#tar -zxvf rrdtool-1.4.5.tar.gz
#./configure --prefix=/usr/local/rrdtool
#make
#make install
安装rrdtool的时候报错
解决方法:yum -y install zlib zlib-devel libpng libpng-devel freetype freetype-devel libart_lgpl
libart_lgpl-devel libxml2 libxml2-devel gd gd-devel cairo cairo-devel pango pango-devel
2.配置snmp
vim /etc/snmp/snmpd.conf
# 修改3项 127.0.0.1 、 all、启用项修改的内容详见我Cacti的安装文档,上面有非常详细的内容介绍)
com2sec notConfigUser 127.0.0.1 public
access notConfigGroup "" any noauth exact all none none
view all included .1 80
service snmpd restart
3.安装cacti
wget http://www.cacti.net/downloads/cacti-0.8.7h.tar.gz
tar zxvf cacti-0.8.7h.tar.gz
mv cacti-0.8.7h /var/www/html

