快速安装Cacti
测试平台:rhel 5.4 cacti版本:0.8.7g
运行环境:LAMP环境
1.安装依赖包:
yum -y 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 php-pear
2.设置开机启动snmpd,httpd,mysqld 服务
3.安装rrdtools
到这里下载最新RRDTools rpm包:
yum -y localinstall –nogpgcheck rrdtool-*.rpm
4.配置snmp
# vi /etc/snmp/snmp.conf
将com2secnotConfigUser default public
改为:com2secnotConfigUser 127.0.0.1 public (这是监控本地,被监控主机设置)
将access notConfigGroup “” any noauth exact systemview none none
改为:accessnotConfigGroup”” any noauth exact all none none
#view all included .1 80
将前面的 # 注释去掉。
重新启动 snmp 服务
5.安装cacti数据以及模板
配置mysql数据库
# mysql
Mysql > CREATE DATABASE cacti;
Mysql > grant all privileges on cacti.* to identified by ‘cacti’;
Mysql > grant all privileges on cacti.* to identified by ‘cacti’;
Mysql > grant all privileges on cacti.* to identified by ‘cacti’;
Mysql >flush privileges;
Mysql >quit
tar xzvf cacti-0.8.7g.tar.gz
# mv cacti-0.8.7g/ /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”
添加用户
useradd cacti
passwd cacti
cd /var/www/html/cacti/
chown -R cacti rra/ log/
# crontab -e
*/5 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1
访问 开始安装
第一次登陆 U/P 都为:admin,并且需要强行修改。
第一次绘图比较慢。需要一定的时间,请耐心等待
四、cacti常用插件安装
要安装别的插件前,先要安装cacti的一个patch--Plugin Architecture,才能支持插件
PA 2.8 = cacti 0.8.7g
# tar xvf cacti-plugin-0.8.7g-PA-v2.8.tar.gz
# cp -R cacti-plugin-arch/* /var/www/html/cacti/
cd /var/www/html/cacti/
mysql -ucacti -pcacti cacti patch -p1 -N vi include/config.php
修改为$url_path = “/cacti/”;
登陆,启用PA。
Monitor,Settings,thold
# tar zxvf monitor-latest.tgz
# tar zxvf settings-latest.tgz
# tar zxvf thold-latest.tgz
# mv monitor-0.9/ /var/www/html/cacti/plugins/monitor
# mv settings-0.6/ /var/www/html/cacti/plugins/settings
# mv thold-0.41/ /var/www/html/cacti/plugins/thold
登陆安装启用对应的插件即可。
通过浏览器访问
使用浏览器打开http://192.168.202.138/install/ 就出现所安装界面了。