分类: LINUX
2012-08-27 17:11:44
Cacti 安装与配置
首先禁用 SELINUX
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
2.设置开机启动 snmpd,httpd,mysqld 服务
启动服务:service snmpd start
service httpd start
service mysqld start
开机自启:chkconfig snmpd on
chkconfig httpd on
chkconfig mysqld on
3.下载最新的 RRDTools rpm 包,进行安装
rrdtool-1.4.4-1.el5.wrl.i386
rrdtool-perl-1.4.4-1.el5.wrl.i386
rrdtool-ruby-1.4.4-1.el5.wrl.i386
使用 yum 安装:yum -y localinstall --nogpgcheck rrdtool-*.rpm
4.配置 snmp
vim /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 服务:service snmpd restart
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
6.安装配置 cacti
# 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” ;
7.添加用户并设置监控时间
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
OK,配置成功,开始登录:
第一次登录用户名密码均为 admin,登录之后需要强行修改密码: 登录界面:
安装插件 需要的包
1、cacti-plugin-0.8.7g-PA-v2.8.tar.gz
2、discovery-0.8.5.tar.gz
3、monitor-0.8.2.tar.gz
4、settings-0.5.tar.gz
5、thold-0.4.3.tar.gz
安装 plugin
tar -zxf cacti-plugin-0.8.7g-PA-v2.8.tar.gz
cp -rf cacti-plugin-arch/* /var/www/html/cacti/
mysql -u cacti -p cacti < /var/www/html/cacti/pa.sql
cd /var/www/html/cacti/
patch -p1 -N < cacti-plugin-0.8.7g-PA-v2.8.diff
vi /var/www/html/cacti/include/global.php
$config['url_path'] = ‘/cacti/’;
进入"用户管理"->点 admin->区域权限 选择上 "Plugin Management"
安装其他插件
DIR=/var/www/html/cacti/plugins
tar -zxf thold-0.4.3.tar.gz -C /var/www/html/cacti/plugins ;
tar -zxf monitor-0.8.2.tar.gz -C /var/www/html/cacti/plugins;
tar -zxf discovery-0.8.5.tar.gz -C /var/www/html/cacti/plugins;
tar -zxf settings-0.5.tar.gz -C /var/www/html/cacti/plugins;
mysql -u cacti -p cacti < $DIR/monitor/monitor.sql
mysql -u cacti -p cacti < $DIR/discovery/discover.sql
mysql -u cacti -p cacti < $DIR/thold/thold.sql
cd /var/www/html/cacti/include/ cp global.php global.php-bak vi global.php
在 session_name($cacti_session_name);添加 $plugins = array();
$plugins[] = 'settings';
$plugins[] = 'thold';
$plugins[] = 'monitor';
$plugins[] = 'discovery';
进入之后,进行模块的添加,效果图如下:
绘图界面: