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

监控和安全运维 1.2 cacti安装

时间:2016-01-03 17:26:53      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:

---恢复内容开始---

一、安装cacti服务器

 

1.首先安装epm扩展源


rpm -ivh http://www.lishiming.net/data/attachment/forum/epel-release-6-8_64.noarch.rpm

centos5

32位epel源下载地址: www.lishiming.net/data/attachment/forum/epel-release-5-4_32.noarch.rpm
64位下载地址:  www.lishiming.net/data/attachment/forum/epel-release-5-4_64.noarch.rpm

centos6
32位epel yum源下载地址: www.lishiming.net/data/attachment/forum/epel-release-6-8_32.noarch.rpm 
64位下载地址: www.lishiming.net/data/attachment/forum/epel-release-6-8_64.noarch.rpm

 

2. (lamp)然后分别安装httpd、php、mysql

yum install -y  httpd php php-mysql mysql mysql-server mysql-devel php-gd  libjpeg libjpeg-devel libpng libpng-devel

 

3. 安装cacti  net-snmp  rrdtool 

yum install -y cacti  net-snmp  net-snmp-utils  rrdtool

 

4. 启动服务:

/etc/init.d/mysqld start
/etc/init.d/httpd  start
/etc/init.d/snmpd start

 

5. 编辑httpd配置文件

vim /etc/httpd/conf.d/cacti.conf  
把"Deny from all" 改为  "Allow from all"
/etc/init.d/httpd  restart

 

6.  导入数据创建cacti库

mysql -uroot  -e "create database cacti"

创建cacti用户

mysql -uroot -e "grant all on cacti.* to ‘cacti‘@‘127.0.0.1‘ identified by ‘cacti‘;"

导入sql文件

mysql -uroot cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql

 

7.  编辑cacti配置文件

vim /usr/share/cacti/include/config.php  

更改如下:
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "127.0.0.1";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";
$database_ssl = false;

 

8. web访问cacti并安装
http://ip/cacti/  
点两下“next” 和一次”Finish“ 即可
输入admin   admin 登录,重新设置新的密码

 

9. 执行poller.php, 生成图形, 加入计划任务

/usr/bin/php /usr/share/cacti/poller.php

添加cron任务

出现warning 搜索 timezone 添加一行

vim /etc/php.ini
date.timezone = Asia/Chongqing
/usr/bin/php /usr/share/cacti/poller.php

  增加

每五分钟执行任务计划

crontab -e
*/5 * * * *  /usr/bin/php /usr/share/cacti/poller.php

 

 

 

监控和安全运维 1.2 cacti安装

标签:

原文地址:http://www.cnblogs.com/wangshaojun/p/5096526.html

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