设为首页 收藏本站
查看: 1196|回复: 0

[经验分享] Cacti安装教程

[复制链接]
发表于 2015-9-7 13:08:41 | 显示全部楼层 |阅读模式
  CentOS 6.0
架设流量监控及集中日志系统
第一章、cacti的安装
1、 系统的基本设置
2、 设置主机名
3、 [iyunv@localhost ~]# vi /etc/sysconfig/network
4、 [iyunv@localhost ~]# exit
5、 重新登陆
6、 [iyunv@GZ-Cacti ~]#
7、 安装screen后台运行程序
yum -y install screen
8、 安装优秀的编辑器vim
yum -y install vim
9、 执行screen -S cacti进程进行安装程序防止断开远程导致安装中断
  
10、 cacti所需组件
http
Mysql
mysql-server
Php
Php-mysql
Php-snmp
php-cli
php-common
Perl-DBD-MySQL
Php-pdo
rrdtool
Net-snmp
Net-snmp-libs
Net-snmp-utils
rrdtool
yum安装这些组件
yum -y install httpd php php-mysql php-snmp php-cli php-common mysql mysql-server net-snmp net-snmp-libs net-snmp-utils php-pdo perl-DBD-MySQL rrdtool
#下载cacti
[iyunv@GZ-cacti ~]# cd /home/
[iyunv@GZ-cacti home]# wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz
#解压cacti
[iyunv@GZ-cacti home]# tar xvf cacti-0.8.7g.tar.gz
#进入cacti文件夹,将里面的文件移动到/var/www/html/
[iyunv@GZ-cacti home]# cd cacti-0.8.7g
[iyunv@GZ-cacti cacti-0.8.7g]#
[iyunv@GZ-cacti cacti-0.8.7g]# mv * /var/www/html/
#启动apache及mysql服务
[iyunv@GZ-cacti cacti-0.8.7g]# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 61.140.3.66 for ServerName
[ OK ]
[iyunv@GZ-cacti cacti-0.8.7g]# /etc/init.d/mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
[iyunv@GZ-cacti cacti-0.8.7g]#
#并将apache、mysql及network加入自启动
# chkconfig --level 35 httpd on
# chkconfig --level 35 mysqld on
#chkconfig network on
建立数据库
mysql> create database cacti;
mysql> grant all privileges on cacti.* to cactiuser@localhost identified by 'cacti' with grant option;
mysql>flush privileges;
导入cacti数据库
[iyunv@GZ-cacti cacti-0.8.7g]# mysql -h localhost -u cactiuser -p cacti </var/www/html/cacti.sql
Enter password:
[iyunv@GZ-cacti cacti-0.8.7g]#
修改cacti配置文件
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";
$database_port = "3306";

#$cacti_session_name = "Cacti";
暂时关闭防火墙
/etc/init.d/iptables stop
检查SELinux现时况态
  要知到你现在是否使用 SELinux:
  # getenforce
enforcing

关闭selinux
修改档案/etc/sysconfig/selinux
  # This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=enforcing
  # SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted.NETwork daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
  把 SELINUX设定为disable, 下次启动系统后将会停止SElinux。
# getenforce
disable
  
进入安装界面
http://(cacti-ip)/install/index.php
确保每个路径都正确点击下一步完成安装
配置snmp
vi /etc/snmp/snmp.conf
(7)配置snmp
vi /etc/snmp/snmp.conf
#将下边这行中的default
com2secnotConfigUser default public
#改为127.0.0.1
com2secnotConfigUser 127.0.0.1 Cacti
#将下边这行中的systemview
access notConfigGroup "" any noauth exact systemview none none
#改为all
access notConfigGroup "" any noauth exact all none none
#将下边这行的注释“#”号去掉
#view all included .1 80
#重启snmpd服务
service snmpd restart
用这个命令进行测试能抓取信息为配置正确
snmpwalk -v 1 localhost -c Cacti
安装ntpdate并且停用自动更新
yum -y install ntpdate
/etc/init.d/ntpdate stop
chkconfig ntpdate off
以cacituser用户增加入一个计划任务,使得 cacti 每五分钟生成一个监控图表。
crontab -e
#加入如下内容。注意poller.php的路径
*/5 * * * * php /var/www/html/poller.php > /dev/null 2>&1
时间同步命令,每十分钟跟因特网同步时钟
*/10 * * * * ntpdate 210.72.145.44 > /dev/null 2>&1
并将rra和log文件夹赋予cactiuser以读写权限,poller.php文件赋予cactiuser用户运行权限
[cactiuser@localhost html]$ chmod 777 rra
[cactiuser@localhost html]$ chmod 777 log
[cactiuser@localhost html]$ chmod 755 poller.php
至此cacti安装完成,稍等五分钟刷新一下就可以出图
  
  本文出自 “明日灵感” 博客,请务必保留此出处http://coolner.blog.iyunv.com/957576/688164

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-110597-1-1.html 上篇帖子: 使用Cacti监控你的网络(二)- Cacti的安装 下篇帖子: CACTI 0.87e 安装
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表