CentOS安装cacti

1.安装软件包

yum install -y httpd php php-mysql \
php-snmp mysql mysql-server \
perl-DBD-MySQL php-pdo net-snmp \
net-snmp-libs net-snmp-utils rrdtool

2.启动相关服务

service httpd start
service mysqld start
service snmpd start
chkconfig httpd on
chkconfig mysqld on
chkconfig snmpd on

3.下载cacti

wget -O /tmp/cacti-0.8.7e.tar.gz http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz
mkdir /home/cacti
tar -xzvf /tmp/cacti-0.8.7e.tar.gz -C /home/cacti
mv /home/cacti/cacti-0.8.7e /home/cacti/htdocs

4.向db添加cacti账号

CREATE USER 'cactiuser' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON cacti.* TO cactiuser@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
<h4>5.导入cacti的数据结构</h4>
<pre lang="bash" escaped="true">
echo "source /home/cacti/htdocs/cacti.sql" | mysql -ucactiuser -pcactiuser cacti

6.配置apache

cat > /etc/httpd/conf.d/cacti.conf <<EOF
<VirtualHost *:80>
    DocumentRoot /home/cacti/htdocs/
    ServerName   cacti.opstool.com
    CustomLog    /home/cacti/logs/access_log combined
    ErrorLog     /home/cacti/logs/error_log
</VirtualHost>
EOF
service httpd restart

7.添加crond任务

mkdir /home/cacti/conf
cat > /home/cacti/conf/cacti <<EOF
*/5 * * * * apache /usr/bin/php /home/cacti/htdocs/poller.php &>/dev/null
EOF
ln -sf /home/cacti/conf/cacti /etc/cron.d/
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降级,以保证兼容.

还没有评论,快来抢沙发!

发表评论

  • 😉
  • 😐
  • 😡
  • 😈
  • 🙂
  • 😯
  • 🙁
  • 🙄
  • 😛
  • 😳
  • 😮
  • emoji-mrgree
  • 😆
  • 💡
  • 😀
  • 👿
  • 😥
  • 😎
  • ➡
  • 😕
  • ❓
  • ❗
  • 70 queries in 0.380 seconds