centos6.4 cacti的安装与配置
1说明
系统centos6.4 64bit
缩写安装 php, nginx, mysql, rrdtool、snmp、cacti
已经安装php, nginx, mysql
cacti官方:http://www.cacti.net/
2安装rrdtool
RRDtool (Round Robin Database Tool)就是一个强大的绘图的引擎,很多工具例如MRTG都可以调用rrdtool绘图。
http://oss.oetiker.ch/rrdtool/download.en.html
安装包http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.9.tar.gz
<span style="font-size:18px;">wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.9.tar.gz
tar zxvf rrdtool-1.4.9.tar.gz
cd rrdtool-1.4.9
./configure</span>
报错
configure: error: Please fix the library issues listed above and try again.
fixed: <span style="font-size:18px;">yum -y install pango*</span>
<span style="font-size:18px;">./configure
make && make install</span>安装完成。
3安装net-snmp
http://www.net-snmp.org/
Net-SNMP是一个免费的、开放源码的SNMP实现,以前称为UCD-SNMP。它包括agent和多个管理工具的源代码,支持多种扩展方式。不仅扩展了获取方式,而且对于数据类型也有一定的扩展。
Net-SNMP不仅提供了管理工具,还提供了一些开发配置工具,这些工具一般使用perl语言的脚本提供:主要包括mib2c、net-snmp-config等。上面所说的两个工具方便开发者进行开发
yum installnet-snmp*(主要安装net-snmpnet-snmp-devel net-snmp-utils net-snmp-libs 组件)
安装完成后修改配置文件:
<span style="font-size:18px;">vim /etc/snmp/snmpd.conf</span>
更改 (1、com2sec notConfigUserdefault public
改为:com2sec notConfigUser 127.0.0.1 public
(2、accessnotConfigGroup “” any noauth exactsystemviewnone none
改为:accessnotConfigGroup “” any noauth exactallnonenone
(3、#view all included.1 80
将前面的 # 注释 去掉。
保存退出 :wq
<span style="font-size:18px;">service snmpd restart</span>
4配置MYSQL数据库
mysql> create database cactidb;
mysql> grant SUPER,REPLICATION CLIENT,process on *.* to cactiuser@localhost identified by 'cactipw';
5安装/ 配置cacti
官网http://www.cacti.net/index.php
<span style="font-size:18px;">useradd cactiuser -g users
passwd cactiuser (pwd:sea123456)
cp cacti-0.8.8c.tar.gz /mnt/sharefiles/www/
cd /mnt/sharefiles/www/
tar zxvf cacti-0.8.8c.tar.gz
mv cacti-0.8.8c cacti
cd cacti</span>
导入sql文件cacti.sql
<span style="font-size:18px;">/usr/local/mysql/bin/mysql -u root -pmysql cactidb < cacti.sql</span>
<span style="font-size:18px;">chown -R cactiuser rra/ log/
cd scripts
chown cactiuser:users *
vim /www/htdocs/cacti/include/config.php</span>
<span style="font-size:18px;">$database_type = “mysql”;
$database_default = “cactidb”;
$database_hostname = “localhost”;
$database_username = “cactiuser”;
$database_password = “cactipw”;</span>
更改用户、密码 等项 与上面给出的对应 保存退出
<span style="font-size:18px;">crontab -u cactiuser -e</span>
加入
*/5 * * * * /usr/local/php-5.4.13/bin/php /mnt/sharefiles/www/cacti/poller.php > /dev/null 2>&1
保存退出:wq
全部设置完毕。
打开浏览器 http://localhost/cacti 进入cacti的初始设置页面
第一次默认登陆账号:admin 密码 admin
登陆后在新改个密码就OK
需要说明的还有路径
snmpwalk Binary Path : /usr/bin/snmpwalk
snmpget Binary Path: /usr/bin/snmpget
RRDTool Binary Path: /usr/rrdtool-1.3.8/src/rrdtool
PHP Binary Path: /www/php/bin/php
Cacti Log File Path: /www/htdocs/cacti/log/cacti.log
Cactid Poller File Path: /www/htdocs/cacti/poller.php
注:此时graphs还不能显示图形,需要将服务重新启动一下
<span style="font-size:18px;">service snmpd restart
service mysql restart
service httpd restart</span>
现在打开http://localhost/cacti进入graphs查看localhost就会有图形了。
要添加自定义图形,请阅读《CACTI使用文档》。
参考源:http://www.zhdba.com/mysqlops/2011/06/08/cacti-install-setting/
页:
[1]