Cacti安装配置文档

测试安装时的稳定版是cacti-0.8.7g、cacti-plugin-0.8.7g-PA-v2.8、rrdtool-1.4.4、net-snmp-5.6(该版本提供基于主机的配置文件等新特性。网上教程大都基于废弃的“com2sec NAME SOURCE COMMUNITY”命令配置文件)

一、软件列表及作用
1、安装rrdtool(cacti用来保存数据及绘图形的工具)
2、安装net-snmp(使用snmpget获取数据)
3、安装cacti(php程序,管理界面)
4、安装spine(基于C快速的轮询引擎,用它替代cmd.php作数据采集)
5、安装插件(扩展监控数据等,cacti-plugin扩展cacti架构而支持插件,monitor图形方式显示设备状态,thold设备异常报警,settings邮件报警)
註:apache、mysql、php环境需先安装好,此处忽略。

二、安装
1、安装rrdtool
wget
yum install cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel
tar -zxvf rrdtool-1.4.4.tar.gz
cd  rrdtool-1.4.4
export PKG_CONFIG_PATH=/usr/lib/pkgconfig/
./configure --prefix=/usr/local/rrdtool
make
make install
/usr/local/rrdtool/bin/rrdtool #测试

2、安装net-snmp
wget
tar -zxvf net-snmp-5.6.tar.gz
cd net-snmp-5.6
./configure --prefix=/usr/local/net-snmp  --enable-developer --with-default-snmp-version="2" --with-sys-contact="admin@admin.com" --with-sys-location="China" --with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp"
make
make install
cp EXAMPLE.conf  /usr/local/net-snmp/share/snmp/snmpd.conf

2.1 修改监听地址
vi /usr/local/net-snmp/share/snmp/snmpd.conf
agentAddress  udp:127.0.0.1:161
2.2 启动及创启SNMP
/usr/local/net-snmp/sbin/snmpd
ps -aux | grep snmpd
killall snmpd
2.3 net-snmp测试指令
本机测试数据
/usr/local/net-snmp/bin/snmpwalk -v 2c -c public localhost
返回非Time out,而是系统信息说明安装成功。

3、安装cacti
wget
tar -zxvf cacti-0.8.7g.tar.gz
mv cacti-0.8.7g /home/htdocs/cacti

3.1 修改配置
cp /home/htdocs/cacti/include/config.php /home/htdocs/cacti/include/config.php.bak
vi /home/htdocs/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "root";
$database_password = "";
3.2 文件属性
chown -R addcn.addcn /home/htdocs/cacti/rra
chgrp -R addcn /home/htdocs/cacti
3.3 週期执行
*/5 * * * * /usr/local/php5/bin/php /home/htdocs/cacti/poller.php > /dev/null 2>&1
3.4 访问浏览
可以访问进行安装,初始账号密码为admin:admin。

4、安装spine
spine是一个基于C语言的,非常快速的轮询引擎。用它替代默认的cmd.php完成数据采集。
wget
tar -zxf cacti-spine-0.8.7g.tar.gz
cd cacti-spine-0.8.7g
./configure --with-snmp=/usr/local/net-snmp
make
make install
cd /usr/local/spine/etc/
cp spine.conf.dist spine.conf
配置数据库用户名及密码
vi spine.conf
/usr/local/spine/bin/spine #测试spine

5、安装插件
5.1 安装cacti-plugin-PA
wget
tar -zxvf cacti-plugin-0.8.7g-PA-v2.8.tar.gz -C /home/htdocs/cacti
cd /home/htdocs/cacti
patch -p1 -N < cacti-plugin-arch/cacti-plugin-0.8.7g-PA-v2.8.diff

#mysql导入sql
/usr/local/mysql/bin/mysql -u root -p
mysql>use cacti;
mysql>set NAMES utf8;
mysql>source /home/htdocs/cacti/cacti-plugin-arch/pa.sql;

页面无css而变形,改为cacti对应于web目录下的路径
vi /home/htdocs/cacti/include/config.php
$url_path = "/cacti/";

5.2 安装其它插件
wget
wget
wget
tar zxvf thold-0.4.2.tar.gz -C /home/htdocs/cacti/plugins
tar zxvf monitor-0.8.2.tar.gz -C /home/htdocs/cacti/plugins
tar zxvf settings-0.5.tar.gz -C /home/htdocs/cacti/plugins
cd /home/htdocs/cacti/plugins/

//mysql导入sql
/usr/local/mysql/bin/mysql -u root -p
mysql>use cacti;
mysql>set NAMES utf8;
mysql>source /home/htdocs/cacti/plugins/thold/thold.sql;
mysql>source /home/htdocs/cacti/plugins/monitor/monitor.sql;

//修改配置
vi /home/htdocs/cacti/include/config.php
$plugins = array();
//$plugins[] = 'thold'; #发现加了会出错
$plugins[] = 'monitor';
$plugins[] = 'settings';

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/pfpyx.html