码迷,mamicode.com
首页 > 其他好文 > 详细

Cacti学习笔记一:基本安装和配置

时间:2016-08-13 12:44:22      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:

 

1.安装依赖包

yum -y install net-snmp-devel mysql mysql-devel openssl-devel libtool

2.安装RRDTool

yum -y install rrdtool

3.安装snmp

yum -y install net-snmp net-snmp-utils

4.安装LAMP

yum -y install httpd mysql-server php php-mysql 
service httpd start
service mysql start

5.安装cacti

下载:
   wget http://www.cacti.net/downloads/cacti-0.8.8h.tar.gz
   tar xf cacti-0.8.8h.tar.gz 
创建账号:
   useradd -m cacti
   passwd cacti
初始化数据库:
   create user cacti@localhost identified by cacti;
   create database cacti;
   grant all on cacti.* to cacti@localhost;
   cd cacti-0.8.8h
   mysql -uroot -p cacti < cacti.sql   如果没有密码,直接回车
创建rrd账号
   useradd cactiuser
   mv cacti-0.8.8h /var/www/html/cacti
   cd /var/www/html/cacti
   chown -R cactiuser rra log
    */5 * *  *  * root  /usr/bin/php /var/www/html/cacti/poller.php  > /dev/null  加入/etc/crontab
出现时间安全问题,修改php.ini
        date.timezone = Asia/Shanghai  去掉注释病修改

6.配置cacti

vim /var/www/html/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";
$database_ssl = false;

7.增加spine,优化的轮询

wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.8a.tar.gz
tar -xvf cacti-spine-0.8.8a.tar.gz
cd cacti-spine-0.8.8a
./configure
make && make install
    
cp  /usr/local/spine/etc/spine.conf.dist  /usr/local/spine/etc/spine.conf
vim /usr/local/spine/etc/spine.conf
   DB_Host         localhost
   DB_Database     cacti
   DB_User         cacti
   B_Pass         cacti
   DB_Port         3306
   DB_PreG         0
测试和数据库是否可以通信
技术分享
配置cacti使用spine轮询
技术分享
技术分享

 查看日志

tail -f /var/www/html/cacti/log/cacti.log

技术分享
轮询方法由cmd.php改变为spine

 

常见问题

没有数据:
        查看tail -f /var/www/html/cacti/log/cacti.log是否每隔5分钟出现日志,如果没有检查定时任务
如果crontab不支持,使用脚本
        [root@monitor shell]# cat /root/shell/foreach_cacti.sh 
        #!/bin/bash
        (while true;
        do
            /usr/bin/php /var/www/html/cacti/poller.php > /dev/null;
            sleep 60;
        done) &

 

Cacti学习笔记一:基本安装和配置

标签:

原文地址:http://www.cnblogs.com/djoker/p/5767673.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!