1.配置好yum源、关掉selinux
# setenforce 0
2.安装所要工具组件:
# yum install httpd php php-mysql php-snmp mysql mysql-server perl-DBD-MySQL php-pdo net-snmp net-snmp-libs net-snmp-utils net-snmp-devel ruby ruby-devel
3.配置启动apache mysql snmp服务
# service httpd start
# chkconfig httpd on
# service mysqld start
# mysqladmin -u root password 'root'
# mysql -uroot -proot
mysql> use mysql
mysql> delete from user where host='';
# chkconfig mysqld on
# service snmpd start
# chkconfig snmpd on
4.安装rrdtools,需要用到rrdtool-1.4.4-1.el5.wrl.i386.rpm、rrdtool-perl-1.4.4-1.el5.wrl.i386.rpm、rrdtool-ruby-1.4.4-1.el5.wrl.i386.rpm
rrdtools.zip # yum localinstall --nogpgcheck rrdtool-*.rpm
5.配置snmp
# vim /etc/snmp/snmp.conf
将com2sec notConfigUser default public
改为
com2sec notConfigUser 192.168.0.0/16 public //此处是修改监控目标
将access notConfigGroup "" any noauth exact systemview none none
改为access notConfigGroup "" any noauth exact all systemview none none
#view all included .1 80
将前面的#注释去掉。
# service snmpd restart
6.安装cacti数据库以及模板
1)配置mysql数据库
# mysql
mysql> CREATE DATABASE cacti;
mysql> grant all privileges on cacti.* to cacti@localhost identified by 'cacti';
mysql> grant all ptivileges on cacti.* to cacti@127.0.0.1 identified by 'cacti';
mysql> grant all ptivileges on cacti.* to cacti@192.168.0.0 identified by 'cacti';
mysql> flush privileges;
mysql> quit
2)安装cacti
# tar zxvf cacti-0.8.7g.tar.gz
# mv cacti-0.8.7g /var/www/html/cacti
# cd
/var/www/html/cacti
# mysql -ucacti -pcacti cacti < /var/www/html/cacti/cacti.sql
# vim /var/www/html/cacti/include/config.php
修改成:
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";
# useradd cacti
# passwd cacti
# chown -R cacti
/var/www/html/cacti/rra
/var/www/html/cacti/log
# crontab -e
*/5 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1
3)访问
第一次登陆user password 都为admin,并且需要强行修改
第一次绘图比较慢,需要一定的时间,请耐心等待
阅读(941) | 评论(0) | 转发(0) |