环境搭建:
主机:windows8 64位+Vmware workstation11
虚拟机:Centos6.6_64位
虚拟机网络为host-only
hostname:node1.test.com ip:192.168.245.11
node2.test.com ip:192.168.245.12
软件:
cacti-0.8.8c
cacti-spine0.0.8c
rrdtool-1.5.2
settings-v0.71-1
thold-v0.5.0
搭建cacti运行需要的环境:LAMP
#yum -y install httpd mysql mysql-server php php-mysql mysql-devel
#yum -y install net-snmp net-snmp-devel net-snmp-libs net-snmp-utils
#service httpd start
#service mysqld start
#service snmpd start
并加入开机自动启动
#chkconfig httpd on
#chkconfig mysqld on
#chkconfig snmpd on
配置snmp:
#vi /etc/snmp/snmpd.conf
将其中62行的systemview改为all,并启用85行:view all included .1 80
#service snmpd restart
#snmpwalk -c public -v 2c localhost system
#tar zxvf rrdtool-1.5.2.tar.gz
#cd rrdtool-1.5.2
#./configure --prefix=/usr/local/rrdtool && make && make install
# ln -s /usr/local/rrdtool/bin/* /usr/sbin/ (修改环境变量也可以)
# tar zxvf cacti-spine-0.8.8c.tar.gz
#./configure --prefix=/usr/local/spine --with-mysql && make && make install
#tar zxvf cacti-0.8.8c.tar.gz
#mv cacti-0.8.8c cacti
#mv cacti /var/www/html/
#mysql -uroot -p
mysql > grant all on cacti.* to cacti@'%' identified by 'cacti';
mysql>flush privileges;
mysql>create database cacti;
#cd /var/www/html/cacti
#mysql -ucacti -pcacti cacti < cacti.sql
#vi .include/config.php
修改账号为cacti,密码为cacti
#crontab -e -u root
*/1 * * * * /usr/bin/php /var/www/html/cacti/poller.php
配置spine
#cd /usr/local/spine/etc/
#mv spine.conf.dist spine.conf
#vi spine.conf
修改账户和密码与config.php一致
DB_Host localhost
DB_Database cacti
DB_User cacti
DB_Pass cacti
DB_Port 3306
接下来就可以web登陆http://192.168.245.11/cacti安装cacti,默认用户密码admin
登陆web,进入
“Setting”-->“Paths”-->“Spine Poller File Path”填写:/usr/local/spine/bin/spine;并“Save”。
接下来安装插件:
#tar -zxvf settings-v0.71-1.tgz -C /var/www/html/cacti/plugins/
#tar -zxvf thold-v0.5.0.tgz -C /var/www/html/cacti/plugins/
然后在web里选择"Plugin Management"进行安装即可
Linux客户端添加(192.168.245.12)
需安装net-snmp net-snmp-utils
编辑配置文件
vi /etc/snmpd/snmpd.conf
将# sec.name source community
com2sec notConfigUser default public
将default改为192.168.245.11
# group context sec.model sec.level prefix read write notif
access notConfigGroup "" any noauth exact systemview none none
将systemview改为all
## incl/excl subtree mask
#view all included .1 80
将view all前的#号去掉
重启snmp
#service snmpd start
#chkconfig snmpd on
这样就可以在node1中添加监控的node2了.