最新Cacti 0.8.8a在linux RHEL5/Centos5下的安装配置[RHEL 5.4]

 Centos Cacti 0.8.8a 安装配置实录

说明:

1,所有加粗字体为命令,可直接复制使用;

2,本文所有操作均为笔者亲自测试成功;如有问题,欢迎随时交流Mailto:[email protected];QQ:17118352;

3,操作系统版本:Linux RedHat Enterprise 5.4 64位,本文中涉及yum更新,如涉及请参考:《yum源更新配置》

 一,参考cacti下载地址:

wget http://www.cacti.net/downloads/cacti-0.8.8a.tar.gz

wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.5.tar.gz

wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.8a.tar.gz

二、安装rrdtool

wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.5.tar.gz

tar xzf rrdtool-1.4.5.tar.gz

cd rrdtool-1.4.5

./configure  --prefix=/usr/local/rrdtool/

make && make install

ln -s /usr/local/rrdtool/bin/* /usr/local/bin/

三、安装cacti

注意* 这里采用yum 安装方式,解决关联和基础问题(别嫌多,大概100M)

1,安装所需基础程序

yum -y install httpd mysql-server mysql-devel php-devel net-snmp php php-mysql php-gd php-pdo php-snmp mysql  lm_sensors net-snmp net-snmp-utils perl-Net-Daemon perl-PlRPC perl-DBI perl-DBD-mysql net-snmp-devel net-snmp-libs gcc* ntp vim-enhanced gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel gettext-devel pam-devel kernel   

2,设置为系统服务器

chkconfig mysqld on

chkconfig httpd on

chkconfig snmpd on 

3.启动服务

service mysqld start

service snmpd start

service httpd start 

4,解压文件,并移动到web服务的默认目录下

tar zxf cacti-0.8.7e.tar.gz 

mv cacti-0.8.7a /var/www/html/cacti

5,建库、授权用户,导入相关表;

cd /var/www/html/cacti/

mysql -uroot -p

mysql>create database cacti;

mysql>grant all on cacti.* to cacti@localhost identified by 'cacti';

mysql>flush privileges;

mysql>use cacti;

mysql>source /var/www/html/cacti/cacti.sql;

 或者直接命令导入: #mysql -ucacti -pcacti cacti</var/www/html/cacti/cacti.sql

6.修改配置文件

vi /var/www/html/cacti/include/config.php  global.php 

     $database_type = "mysql";

     $database_default = "cacti";

     $database_hostname = "localhost";

     $database_username = "cacti"; 

     $database_password = "cacti";

     $database_port = "3306"; 

7.调整目录权限

chmod -R 777 /var/www/html/cacti/rra

chmod -R 777 /var/www/html/cacti/log 

8.添加http配置文件

vi /etc/httpd/conf.d/cacti.conf

Alias /cacti/ /var/www/html/cacti/

 <Directory /var/www/html/cacti/>

DirectoryIndex index.php

Options -Indexes

AllowOverride all

order deny,allow

AddType application/x-httpd-php .php

php_flag magic_quotes_gpc on

php_flag track_vars on

</Directory>

 

9.重启web服务器

service httpd restart

10.设置轮询器

crontab -e

添加:

*/5 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1

 

四、访问验证:

直接访问 http://127.0.0.1/cacti/或者 http://服务器ip/cacti/

安装会提示我们点击下一步即可,检查好snmp路径和rrdtool路径及版本是否正确,安装完成默认密码是admin/admin

cacti会提示我们强制修改密码ok 

五,安装spine轮询器(优化取值方式)

(注意了 这里的spine版本要与cacti版本一致:这里使用 cacti-spine-0.8.8a.tar.gz   

tar xzf cacti-spine-0.8.8a.tar.gz 

cd cacti-spine-0.8.8a 

./configure && make && make install 

安装完默认路径在/usr/local/spine/,接下来配置spine

#cp /usr/local/spine/etc/spine.conf.dist  /etc/spine.conf 

即可!修改spine.conf里面配置,填写正确的cacti用户名和密码等!

建立软链接:

ln -s /usr/local/spine/bin/spine /usr/local/bin/spine

最后执行spine命令可以显示cacti版本相关信息即安装成功!

./spine

然后在cacti后台的console-->setting-->path页面,修改Spine Poller File Path路径为:/usr/local/bin/spine并点击"Save"保存配置

再把默认抓取方式改成spine方式即可:console-->setting-->poller-->Poller Type,选spine,点击"Save"保存配置

然后查看cacti页面日志(Console -> System Utilities -> View Cacti Log File )看看是否正常!

其他插件可直接访问:http://docs.cacti.net/plugins

 

你可能感兴趣的:(linux,cacti,Spine)