CentOS安装cacti

1.安装软件包
  1. yum install -y httpd php php-mysql \
  2. php-snmp mysql mysql-server \
  3. perl-DBD-MySQL php-pdo net-snmp \
  4. net-snmp-libs net-snmp-utils rrdtool
2.启动相关服务
  1. service httpd start
  2. service mysqld start
  3. service snmpd start
  4. chkconfig httpd on
  5. chkconfig mysqld on
  6. chkconfig snmpd on
3.下载cacti
  1. wget -O /tmp/cacti-0.8.7e.tar.gz http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz
  2. mkdir /home/cacti
  3. tar -xzvf /tmp/cacti-0.8.7e.tar.gz -C /home/cacti
  4. mv /home/cacti/cacti-0.8.7e /home/cacti/htdocs
4.向db添加cacti账号
  1. CREATE USER 'cactiuser' IDENTIFIED BY 'yourpassword';
  2. GRANT ALL PRIVILEGES ON cacti.* TO cactiuser@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
  3. FLUSH PRIVILEGES;
5.导入cacti的数据结构
  1. echo "source /home/cacti/htdocs/cacti.sql" | mysql -ucactiuser -pcactiuser cacti
6.配置apache
  1. cat > /etc/httpd/conf.d/cacti.conf <<EOF
  2. <VirtualHost *:80>
  3. DocumentRoot /home/cacti/htdocs/
  4. ServerName cacti.opstool.com
  5. CustomLog /home/cacti/logs/access_log combined
  6. ErrorLog /home/cacti/logs/error_log
  7. </VirtualHost>
  8. EOF
  9. service httpd restart
7.添加crond任务
  1. mkdir /home/cacti/conf
  2. cat > /home/cacti/conf/cacti <<EOF
  3. */5 * * * * apache /usr/bin/php /home/cacti/htdocs/poller.php &>/dev/null
  4. EOF
  5. ln -sf /home/cacti/conf/cacti /etc/cron.d/
  6. service crond reload
8.登录http://cacti.opstool.com
使用默认的用户名密码admin/admin登录,第一次登录后会提示修改密码。 问题:
1.graphs显示无图
原因:cacti中设置rrdtool的版本与系统实际安装的版本不一样。进入cacti,点击console-Settings,然后设置RRDTool Utility Version,选择与系统的一致。如果系统rrdtool版本比cacti中最高的版本还高,那只能选择cacti中支持的最高rrdtool版本尝试一下,如果不行要么考虑cacti升级,要么rrdtool降级,以保证兼容.
上一篇:Spring学习之Aspectj开发实现AOP


下一篇:Android拍照保存在系统相册不显示的问题