cacti安装
环境 centos4.4
1>安装软件包
yum
-y install libart_lgpl perl-Time-HiRes net-snmp net-snmp-devel
net-snmp-perl php-snmp mysql mysql-server* php php-devel php-mysql
rpm -ivh
rpm -ivh
rpm -ivh http://riksun.riken.go.jp/pub/pub/Linux/dag/packages/rrdtool/rrdtool-devel-1.2.23-1.el4.rf.i386.rpm
cd /home
wget
###(必须用这个版本,其他版本有太多BUG)
###ftp://194.199.20.114/linux/fedora/core/development/i386/os/Fedora/php-5.2.2-3.i386.rpm
tar -zxvf cacti-0.8.6i.tar.gz
###然后把 cacti-0.8.6i重命名成 cacti并拷贝到/var/www/html下
mkdir -p /var/www/html
cp -r cacti /var/www/html
cd /var/www/html/cacti
chown -R cactiuser log rra
2>设置
1.解压cacti-0.8.6i.tar.gz,并拷贝到 /vaw/www/html/cacti下
2.useradd cactiuser
passwd cactiuser
###密码为cacti
cd /var/www/html/cacti
chown -R cactiuser.cactiuser log rra
3.4.配置数据库
mysqladmin --user=root create cacti
mysql cacti < cacti.sql
mysql --user=root mysql
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cacti';
flush privileges;
5.配置cacti登陆mysql用户名和密码(/var/www/html/cacti/include/config.php)
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";
6.设置poller.php
crontab -u cactiuser -e
*/5 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2 > 1&
7.配置并启动snmpd服务
###################/etc/snmp/snmpd.conf######################
rocommunity public
# sec.name source community
com2sec local localhost public
com2sec mynetwork 192.168.10.0/24 public
com2sec mynetwork1 192.168.1.0/24 public
# groupName securityModel securityName
group MyGroup v1 local
group MyGroup v1 mynetwork
group MyGroup v1 mynetwork1
# name incl/excl subtree mask(optional)
view all-mibs included .1 80
access MyGroup "" v1 noauth 0 all-mibs none none
################################################################
启动snmpd服务
service snmpd restart
8.启动httpd,mysql. 然后登陆cacti
3>其他
1.安装时必须用cacti-0.8.6i.tar.gz 其他版本问题多
2.使用以下命令检查是否可以取到snmp数据
snmpwalk -v 1 *.*.*.* -c public
没有的话是snmpd没起 或配置错误 或网络错误
3.检查cacti是否取到数据 先 cd /var/www/html/cacti/rra
rrdtool fetch ******.rrd AVERAGE
如果全部为nan 则进行第四步
4.在cacti server上 su cactiuser 然后在/var/www/html/cacti目录下执行php poller.php 看cacti时候能识别取到的数据
一般显示错误 waitting on 1/1 poller 是因为snmpd.conf配置错误 或 cacti版本问题,解决办法是重新检查snmpd.conf配置文件或更换其他cacti版本
5.CMDPHP:
Poller[0] ERROR: Cannot connect to MySQL server on 'localhost'. Please
make sure you have specified a valid MySQL database name in
'include/config.php'
出现该错误多半是因为mysql.sock位置在 /tmp 而非 /var/lib/mysql 的原因 解决办法
把/etc/my.cof中mysql.sock位置改成/var/lib/mysql即可
阅读(430) | 评论(0) | 转发(0) |