系统:CentOS-6.3-x86_64
1,添加第三方软件仓库
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
2,YUM安装包并启动:
yum install cacti mysql-server net-snmp* crond cjkuni-ukai-fonts.noarch 0:0.2.20080216.1-35.el6
/etc/init.d/mysqld start ;check mysqld on
/etc/init.d/httpd start ;check httpd on
/etc/init.d/snmpd start ;check snmpd on
/etc/init.d/crond start ;check crond on
注:cjkuni-ukai-fonts.noarch 0:0.2.20080216.1-35.el6 安装完后,执行以下命令,即可显示中文。
sed -i '2i setlocale(LC_CTYPE,"UTF8","en_US.UTF-8");' /usr/share/cacti/lib/functions.php
3,创建cacti数据库,用户
//启动mysql服务器
//root账户,添加数据库
mysql> show databases;
mysql> create database cacti;
mysql> grant all ON cacti.* TO 'cacti'@'localhost' identified by 'cactipasswd';
mysql> flush privileges;
4,导入cacti数据库
//查找一下cacti.sql文件位置
[root@localhost cacti]# locate cacti.sql OR find / -name cacti.sql
/usr/share/doc/cacti-0.8.8a/cacti.sql
//导入数据库
mysql -ucacti -p -h 127.0.0.1 cacti < /usr/share/doc/cacti-0.8.8a/cacti.sql
5,修改cacti的config.php
vim /usr/share/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cactipasswd";
6,修改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
将前面的 # 注释去掉,改为
view all included .1 80
7,采集数据crontab -e
*/5 * * * * /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
8,配置web环境
http://serverip/cacti访问并配置。
引用:
http://blog.51yip.com/server/1350.html
http://hi.baidu.com/wangli19880718/item/f00aac462412a12b10ee1ebe