系统版本:CentOS6.5
软件版本:cacti-0.88f
需要预安装的软件有以下几种,可以通过yum安装全部
yum -y install net-snmp*
yum -y install openssl*
yum -y install rrd*
yum -y install httpd* mysql* php*
yum -y install libtool*
配置软件开机自动启动:
chkconfig mysqld on
chkconfig httpd on
chkconfig snmpd on
chkconfig iptables off
打开/etc/php.ini
编辑:extension_dir = /etc/php.d
确保/etc/php.d/mysql.ini文件中有如下设置:
extension=mysql.so
确保/etc/php.d/snmp.ini中有如下设置:
extension=snmp.so
更改数据库密码为limg@4px.com
Mysqadmin –u root password “limg@4px.com”
创建数据库cacti
进入数据库:mysql –u root –p 回车输入limg@4px.com
创建cacti数据库:mysql>reate database cacti;
开放数据库cacti的访问权限(cacti用户用密码cacit111111可以访问cacti数据库中的所有数据)
mysql> grant all on cacti.* to cacti@localhost identified by "cacti111111";
mysql> flush privileges;
解压缩cacti软件
tar xzf cacti-0.8.8f.tar.gz
tar xzf cacti-spine-0.8.8f.tar.gz
在/var/www/html中建立cacti文件夹,并将cacti-0.88f中所有文件复制到cacti文件夹中
mkdir /var/www/html/cacti/
cp -fr /usr/src/cacti-0.8.8f/* /var/www/html/cacti/
cd /var/www/html/cati/
初始化数据库:
mysql -u root -p cacti < cacti.sql
编辑include/config.php
[root@localhost cacti-0.8.8f]# vi include/config.php
找到如下项,改成相应的设置值:
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti111111";
$database_port = "3306";
打开/etc/crontab文件,添加如下一行:
*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1
安装cacti-spine
cd /usr/src/cacti-spine-0.8.8f
添加cacti用户
useradd cacti
passwd cacti
依次输入如下命令:
libtoolize --force
autoheader
autoconf
automake
./configure
make
make install
在/etc/中创建spine.conf配置文件
cp /usr/local/spine/etc/spine.conf.dist /etc/spine.conf
更改spine.conf文件属性
chown cacti.cacti /etc/spine.conf
编辑spine.conf配置文件
vi /etc/spine.conf
相应的修改数据库连接选项
DB_Host localhost
DB_Database cacti
DB_User cacti
DB_Pass cacti111111
DB_Port 3306
启动spine
/usr/local/spine/bin/spine
显示如下信息
[root@localhost ~]# /usr/local/spine/bin/spine
SPINE: Using spine config file [/etc/spine.conf]
打开cacti网页:http://10.20.25.24/cacti