已验证,http://www.cnblogs.com/wayde-Z/p/5969885.html
整理一份cacti的安装步骤.留作笔记和以后参考用.
环境:
centos 6.6 -x64
cacti-0.8.8b-cn.tar.gz
mysql yum安装即可
yum服务使用centos自带的就行.如果是红帽请自行解决yum.本文不赘述.
**注意:同步好服务器的时间.免得后面加上监控服务器不出图.
1.安装基础服务(LAMP)
#yum -y install mysql-server httpd php php-mysql zlib freetype libjpeg fontconfig gd libxml2 zlib freetype libjpeg fontconfig gd libxml2 php-gd rrdtool rrdtool-devel net-snmp net-snmp-devel net-snmp-utils
配置snmp
1 vi /etc/snmp/snmpd.conf 2 com2sec notConfigUser default public 3 改为:com2sec notConfigUser 127.0.0.1 public 4 access notConfigGroup "" any noauth exact systemview none none 5 改为:access notConfigGroup "" any noauth exact all none none 6 #view all included .1 80 去掉注释
启动服务并加如开机启动
service httpd start service mysqld start service snmpd start chkconfig httpd on chkconfig mysqld on chkconfig snmpd on
安装cacti
wget http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz tar zxf cacti-0.8.7e.tar.gz -C /var/www/html/
cd /var/www/html/
mv cacti-0.8.7e/ cacti
初始化数据库
mysql -u root 2 mysql> create database cacti; 3 mysql> grant all on cacti.* to cacti@localhost identified by 'cacti'; 4 mysql> grant all on cacti.* to cacti@'127.0.0.1' identified by 'cacti'; 5 mysql> flush privileges; 6 mysql> use cacti; 7 mysql> source /var/www/html/cacti/cacti.sql;
8 mysql> quit
配置cacti
1 vi /var/www/html/cacti/include/config.php 2 $database_type = "mysql"; 3 $database_default = "cacti"; 4 $database_hostname = "localhost"; 5 $database_username = "cacti"; 6 $database_password = "cacti"; 7 $database_port = "3306"; 把配置文件里改成和这里一样的就可以了.
设置相关权限和计划任务.
useradd cacti -d /var/www/html/cacti -s /sbin/nologin chown -R cacti /var/www/html/cacti/rra /var/www/html/cacti/log
echo '*/5 * * * * root /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1' >> /etc/crontab
初始化cacti
访问你的cacti.地址如下.红色替换成你的服务器ip
http://192.168.0.13/cacti
如果显示的页面和这个一样.说明你前面配置的没有问题了.
直接点击next>>
如果都显示ok则可以点击finish.如果有not found 则要看看是哪个命令或者路径不对.
finsh之后就是登录界面了,用户名和密码都是admin.
第一次登录需要修改密码.如下
填入新密码保存即可.
这样cacti就安装完成了.
- 插件安装
wget http://www.cacti.net/downloads/pia/cacti-plugin-0.8.7g-PA-v2.8.tar.gz
tar zxf cacti-plugin-0.8.7g-PA-v2.8.tar.gz
cp -R cacti-plugin-arch/* /var/www/html/cacti
yum install -y patch
cd /var/www/html/cacti
mysql -ucacti -p cacti < pa.sql
patch -p1 -N < cacti-plugin-0.8.7g-PA-v2.8.diff
vi include/global.php
增加$config['url_path'] = “/cacti/”;
service httpd restart
service mysqld restart
进入"用户管理"->点admin->区域权限->Plugin Management,画勾,save。
下载以下3个插件
•thold-v0.4.9-3.tgz
•monitor-v1.3-1.tgz
•settings-v0.71-1.tgz
tar zxf settings-v0.71-1.tgz -C /var/www/html/cacti/plugins
tar zxf monitor-v1.3-1.tgz -C /var/www/html/cacti/plugins
tar zxf thold-v0.4.9-3.tgz -C /var/www/html/cacti/plugins
在console--Configuration--Plugin Management里面点击安装,启用即可。
最后插件这几行未见到monitor选项卡。
尝试了以下3条命令,还是未果。
cd /var/www/html/cacti/plugins/monitor/
mysql -ucacti -p cacti < monitor.sql
vi global.php 增加$plugins[] = 'monitor';