傷痛美人兒 发表于 2015-9-8 07:14:31

cacti yum搭建

  #yum install httpd php php-mysql php-snmp mysql mysql-server net-snmp net-snmp-utils rrdtool rrttool-php cacti
  #chkconfig mysqld on
  #servicemysqld start
  #mysqladmin -uroot password 'mypasswd'
  #mysqladmin -u root -p create cacti
  #mysql -uroot -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql            (cacti是自己安装的版本)
  #mysql -uroot -p mysql    (输入前面设置的密码 mypasswd)
  mysql> grant all on cacti.* to cacti@localhost identified by 'cactipassword' ;   (进入mysql后,提示变成了mysql,这里创建一个                                    cacti的用户,设定密码为cactipassword,另外一个,最后面的“;”一定不能少)
  mysql> flush privileges;   (刷新权限,同样的“;”不能少)
  mysql> \q   (退出)
  #vi /usr/share/cacti/include/config.php
  $database_type = "mysql"; $database_default = "cacti"; $database_hostname = "127.0.0.1"; $database_username = "cacti"; $database_password = "cactipassword"; $database_port = "3306"; $database_ssl = false;
  保存后退出
  #crontab -e -u cacti
  */5 * * * *php /usr/share/cacti/poller.php > /dev/null 2>&1
  保存退出
  #vi /etc/httpd/conf.d/cacti.conf
  Alias /cacti /usr/share/cacti <Directory /usr/share/cacti/> Order Deny,Allow Alow from all </Directory>
  保存退出
  #vi /etc/snmp/snmpd.conf
  access notConfigGroup "" any noauth exact all none none
  view all included .1 80
  第一个是改倒数三个单词,第一行是去掉#,然后保存退出
  #chkconfig httpd on
  #chkconfig snmpd on
  #chkconfig snmptrapd on
  #service mysqld restart
  #service httpd start
  #service snmpd start
  #service snmptrapd start
  #vi /etc/sysconfig/iptables
  -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p udp --dport 161 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p udp --dport 162 -j ACCEPT
  在上面第一行的下面紧接着添加下面几行,保存退出
  #service iptables restart
  # vi /etc/selinux/config #SELINUX=enforcing #注释掉 #SELINUXTYPE=targeted #注释掉 SELINUX=disabled #增加 :wq 保存,关闭
  #shutdown -r now #重启系统
  此时cacti已经可以用了。接着就是设置问题了
  而被监控机需要添加snmp
  #vi /etc/sysconfig/iptables #编辑防火墙配置 -A INPUT -m state --state NEW -m udp -p udp --dport 161 -j ACCEPT
  #service iptables restart
  #yum -y install net-snmp
  #chkconfig snmpd on #设置开机启动 #service snmpd start #启动snmpd
  #vi /etc/snmp/snmpd.conf #编辑,修改为下面的内容 com2sec notConfigUser 192.168.100.120 public access notConfigGroup "" any noauth exact all none none view all included .1 80
  此至被监控机配置完成
页: [1]
查看完整版本: cacti yum搭建