cacti 搭建步骤

问题汇总:
1、poller cron超时:查看是否安装crond及crontabs,使用crontab -e编辑定时采集程序和页面setting一致,重启crond服务
2、cacti报php的timezone不安全:编辑/etc/php.ini 将timezone改为PRC:
安装过程:
1、安装c编译器,SNMP协议,搭建lamp环境
yum install gcc
yum install net-snmp net-snmp-libs net-snmp-devel rrdtool
yum install mysql-server mysql-devel php php-mysql httpd
yum install net-snmp-utils net-snmp-libsnet-snmp-devel
2、开机启动httpd服务及MySQL服务,crontab服务
chkconfig httpd on
chkconfig mysqld on
chkconfig crond on
/etc/init.d/httpd start
/etc/init.d/mysqld start
/etc/init.d/crond start
setenforce 0
3、新建MySQL数据库root密码,创建cacti数据库
mysqladmin -u root -p password "newpassword"
mysql -u root -p
create database cacti;
4、解压cacti安装包
tar -xzvf cacti-0.8.8b.tar.gz
mv cacti-0.8.8b /var/www/html/cacti
5、将cacti数据库模板文件导入cacti数据库
mysql -u root -p
show databases;
create database cacti;
show databases;
quit
mysql -u root -p cacti < /var/www/html/cacti/cacti.sql
6、对cacti数据库赋权
mysql -u root -p
CREATE USER 'cacti'@'localhost' IDENTIFIED BY 'cacti123';
GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cacti123';
flush privileges;
exit

7、配置cacti数据库
vi /var/www/html/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti123";
$database_port = "3306";
$database_ssl = false;

8、登陆cacti并安装
http://IP/cacti
用户名密码均为admin

9、安装spine采集模块
tar -xzvf  cacti-spine-0.8.8b.tar.gz
cd cacti-spine-0.8.8b
./configure
make
make install
10、配置spine采集模块写入数据库
cp /usr/local/spine/etc/spine.conf.dist /etc/spine.conf
vi /etc/spine.conf
DB_Host         localhost
DB_Database     cacti
DB_User         cacti
DB_Pass         cacti123
DB_Port         3306
DB_PreG         0
11、定制crontab定时刷新cacti的
yum install crontabs
vi /etc/crontab
*/1 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1

12、修改PHP时区并重启httpd服务
vi /etc/php.ini
time.zone=PRC
/etc/inti.d/httpd restart
13、配置cacti
http://ip/cacti
登陆cacti后,单击setting,选择path选项卡,修改文件路径保证正确,选择puller选项卡,采集选择spine

你可能感兴趣的:(linux,software,CACTI搭建)