q2009a06z22 发表于 2019-1-9 11:35:39

cacti_1.0.1安装教程

  
  参考自:http://www.iyunv.com/thread-25844-1-1.html
          https://www.youtube.com/watch?v=rqK5OnbF1BY
  需要到国外网站下载软件,大陆用户下载速度较慢
  #vi /etc/sysconfig/selinux   //把SELINUX=enforcing改为SELINUX=disabled
# setenforce 0   //立即关闭selinux,上一步修改要重启系统后才生效


  放行80、3306端口
# iptables -I INPUT-p tcp --dport 80 -jACCEPT ; iptables -I INPUT-p tcp--dport 3306 -j ACCEPT ;
#service iptables save
  
  1安装cacti依赖的软件,安装过程全选Y
  #yuminstall httpd php php-process php-ldap php-mbstringphp-gd php-pdo php-snmp php-mysql lm_sensors net-snmp net-snmp-utilsnet-snmp-libs rrdtool rrdtool-develperl-DBI perl-rrdtool perl-DBD-MySQL wqy-zenhei-fonts
  2装好依赖软件之后,snmp有3个地方需要配置一下
  3 #vim /etc/snmp/snmpd.conf   
  第41行:将 com2secnotConfigUser default public 中的 "default" 改为 "127.0.0.1"
提示 :41可直接跳到41行,下面同理
  第62行:将 accessnotConfigGroup "" any noauth exact systemview none none 中的 "systemview" 改为 "all"
  第85行:将 #viewall include .1 80 这一行前面的 # 号去掉
  4配置好snmp以后我们来启动2个重要的服务
  #service snmpd start ; service httpdstart ; chkconfig snmpd on ; chkconfig httpd on
  5安装并配置cacti
  #wget http://www.cacti.net/downloads/cacti-1.0.1.tar.gz
  #tar xzvf cacti-1.0.1.tar.gz
  #mv cacti-1.0.1 /var/www/html/cacti
  6下载和设置mysql数据库
  #wget https://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm//下载mysql的yum源,以安装mysql5.7,默认的版本和cacti不兼容
# rpm -ivh mysql57-community-release-el6-9.noarch.rpm
# yum install mysql-community-server
  7修改MySQL的配置文件(默认为/etc/my.cnf),在下添加一行skip-grant-tables
  #service mysqld star; chkconfig mysqldon
  #mysql
  mysql> update mysql.user setauthentication_string=password('新密码') where user='root' and Host ='localhost';
  mysql> flush privileges;
  mysql> quit;
  8将/etc/my.cnf文件还原,重新启动mysql
  #mysql -uroot -p   //输入刚才设置的密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '数据库密码'; //再次执行修改密码的命令(和之前的密码相同),新版数据库的安全要求高
  mysql>create database cacti;   //首先创建cacti数据库,注意别丢了分号
  mysql>grant all privileges oncacti.* to cacti@localhost identified by '新密码' with grant option;    //创建cacti用户并授权
  mysql>use cacti;
  mysql>source/var/www/html/cacti/cacti.sql;    //导入cacti数据库文件
  mysql>grant select on mysql.time_zone_nameto 'cacti'@'localhost' identified by '数据库密码'; //给cacti 对mysql.time_zone_name表的查询权限(这两个命令需执行,否则安装中途会报错)
  mysql> flush privileges;
  
  mysql>exit
  
  9 #vim/var/www/html/cacti/include/config.php
  $database_type = "mysql";
  $database_default = "cacti";
  $database_hostname ="localhost";
  $database_username = "cacti";   
  $database_password = " 数据库密码 ";   
  $database_port = "3306";
  执行命令,否则安装过程会报错
# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -p mysql
  10修改mysql默认参数,以支持cacti版本要求(直接粘贴到最后一行)
  #vim /etc/my.cnf
  log-error=/var/log/mysqld.log
  pid-file=/var/run/mysqld/mysqld.pid
  max_heap_table_size=400M
  max_allowed_packet=16777216
  tmp_table_size=64M
  join_buffer_size=64M
  innodb_buffer_pool_size=1912M
  innodb_doublewrite=OFF
  innodb_flush_log_at_timeout=3
  innodb_read_io_threads=32
  innodb_write_io_threads=16
  # service mysqld restart
  11修改目录的所有者为apache
   #cd/var/www/html/
# chown -R apache:apache cacti

12:增加cacti 用户以用来写入rrd和log目录的数据,否则就会生成不了图片
#useradd cacti
#cd cacti
#chown -R cacti rra/ log/
  13:添加任务计划
具体多长时间让cacti生成一次监控图表自己决定,这里以cacti的默认时间5分钟生成一次为例
#crontab -e
加入这一行保存即可
*/5 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1
  14在浏览器输入http://ip/cacti
  图片不太清晰,在倒数第三个图注意下,其它的默认下一步就行了
  https://s5.运维网.com/wyfs02/M02/8D/75/wKioL1idMOuDu37rAAD_QRl5DpU315.png-wh_500x0-wm_3-wmp_4-s_2903569041.png
https://s2.运维网.com/wyfs02/M00/8D/77/wKiom1idMQHBgN7AAAEINLCpspk083.png-wh_500x0-wm_3-wmp_4-s_1371479791.png
https://s2.运维网.com/wyfs02/M00/8D/77/wKiom1idMQKwmHQuAACnBrfmURo272.png-wh_500x0-wm_3-wmp_4-s_159941207.png
https://s2.运维网.com/wyfs02/M00/8D/75/wKioL1idMQKyJ3IYAADUBF_p3Kw655.png-wh_500x0-wm_3-wmp_4-s_3352272837.png
https://s4.运维网.com/wyfs02/M00/8D/75/wKioL1idMQOQu4ZZAAEmqe9qQmU110.png-wh_500x0-wm_3-wmp_4-s_4201859371.png
https://s4.运维网.com/wyfs02/M01/8D/77/wKiom1idMQSwaKSmAAD6lU40cG8504.png-wh_500x0-wm_3-wmp_4-s_3981886289.png
  15用户名和密码都为admin
https://s2.运维网.com/wyfs02/M01/8D/75/wKioL1idMQTTnAOzAACOnN5kBXo038.png-wh_500x0-wm_3-wmp_4-s_1312013021.png
https://s1.运维网.com/wyfs02/M02/8D/77/wKiom1idMQWy_j-RAACnBk_RFdk859.png-wh_500x0-wm_3-wmp_4-s_429342497.png
  16配置完成,稍等几分钟后就可以监控了
  
  
  


  
  
  
  
  Cacti常见错误http://www.cnblogs.com/taosim/articles/2557762.html
  




页: [1]
查看完整版本: cacti_1.0.1安装教程