码迷,mamicode.com
首页 > 其他好文 > 详细

Redhat 5.8 安装cacti 0.8.8c

时间:2015-03-09 19:30:09      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:安装   redhat   cacti   

一、Cacti简介

Cacti是一套基于PHP,MySQL,SNMP及RRDTool开发的网络流量监测图形分析工具。

简单的说Cacti 就是一个PHP 程序。它通过使用SNMP 协议获取远端网络设备和相关信息,(其实就是使用Net-SNMP 软件包的snmpget 和snmpwalk 命令获取)并通过Rrdtool 工具绘图,通过PHP 程序展现出来。我们使用它可以展现出监控对象一段时间内的状态或者性能趋势图。


二、准备和配置

1.准备所需要的软件包,apache、mysql、php、snmp通过yum安装

Rrdtool官网:http://oss.oetiker.ch/rrdtool/

Cacti官网:http://www.cacti.net/


[root@localhost ~]#yum -y install httpd

[root@localhost ~]#yum -y install mysql mysql-server mysql-devel

[root@localhost ~]#yum -y install php php-devel php-mysql php-pdo php-gd

[root@localhost ~]#yum -y install net-snmp php-snmp net-snmp-utils net-snmp-devel net-snmp-perl 


[root@localhost ~]#yum -y install gcc gcc-c++

[root@localhost ~]#yum -y install libxml2-devel 


[root@localhost ~]#yum -y install pango-devel pango 

报错:由于我的yum不能安装这两个文件,我用光盘装了下

pango-devel-1.14.9-8.el5.centos.3.i386 from base has depsolving problems

  --> Missing Dependency: pango = 1.14.9-8.el5.centos.3 is needed by package pango-devel-1.14.9-8.el5.centos.3.i386 (base)

Error: Missing Dependency: pango = 1.14.9-8.el5.centos.3 is needed by package pango-devel-1.14.9-8.el5.centos.3.i386 (base)

 You could try using --skip-broken to work around the problem

 You could try running: package-cleanup --problems

                        package-cleanup --dupes

                        rpm -Va --nofiles --nodigest


挂载光盘到/mnt下

[root@localhost ~]#mount /dev/cdrom /mnt/

[root@localhost ~]#  find /mnt/ -name "pango*rpm"

[root@localhost ~]#/mnt/CentOS/pango-1.14.9-6.el5.centos.i386.rpm

[root@localhost ~]#/mnt/CentOS/pango-devel-1.14.9-6.el5.centos.i386.rpm


[root@localhost ~]#rpm -ivh /mnt/CentOS/pango-1.14.9-6.el5.centos.i386.rpm


[root@localhost ~]#rpm -ivh /mnt/CentOS/pango-devel-1.14.9-6.el5.centos.i386.rpm

又报错,这是因为有依赖关系

[root@localhost ~]# rpm -ivh /mnt/CentOS/pango-devel-1.14.9-6.el5.centos.i386.rpm

error: Failed dependencies:

        cairo-devel >= 1.2.2 is needed by pango-devel-1.14.9-6.el5.centos.i386

        fontconfig-devel >= 2.0 is needed by pango-devel-1.14.9-6.el5.centos.i386

        freetype-devel >= 2.1.3-3 is needed by pango-devel-1.14.9-6.el5.centos.i386

        glib2-devel >= 2.12.0-1 is needed by pango-devel-1.14.9-6.el5.centos.i386

        libX11-devel is needed by pango-devel-1.14.9-6.el5.centos.i386

        libXext-devel is needed by pango-devel-1.14.9-6.el5.centos.i386

        libXft-devel is needed by pango-devel-1.14.9-6.el5.centos.i386

        libXrender-devel is needed by pango-devel-1.14.9-6.el5.centos.i386


[root@localhost ~]#yum -y install cairo-devel fontconfig-devel freetype-devel glib2-devel libX11-devel libXext-devel libXft-devel libXrender-devel


继续安装

[root@localhost ~]#rpm -ivh /mnt/CentOS/pango-devel-1.14.9-6.el5.centos.i386.rpm


2.安装rrdtool

[root@localhost ~]#tar zxvf rrdtool-1.4.5.tar.gz

[root@localhost ~]#cd rrdtool-1.4.5

[root@localhost ~]#./configure --prefix=/usr/local/rrdtool

[root@localhost ~]#make && make install

[root@localhost ~]#ln -s /usr/local/rrdtool/bin/* /usr/local/bin/


3.安装cacti

[root@localhost ~]#tar zxvf cacti-0.8.8c.tar.gz

[root@localhost ~]#useradd -d /var/www/html/cacti cacti -s /sbin/nologin

[root@localhost ~]#mv cacti-0.8.8c/*  /var/www/html/cacti

[root@localhost ~]#chown -R cacti:cacti /var/www/html/cacti

[root@localhost ~]#chmod 755 -R /var/www/html/cacti


4.安装轮询器:cacti-spine

[root@localhost ~]#tar zxvf cacti-spine-0.8.8c.tar.gz

 [root@localhost ~]#cd cacti-spine-0.8.8c

[root@localhost ~]#./configure --prefix=/usr/local/spine

[root@localhost ~]#make && make install


报错:

[root@localhost cacti-spine-0.8.8c]# ./configure --prefix=/usr/local/spine

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... configure: error: newly created file is older than distributed files!

Check your system clock


设置时间2015年3月6号16:21 

[root@localhost ~]# date -s "2015-03-06 16:21:40" 

修改完后,输入:[root@localhost ~]#clock -w 

把系统时间写入CMOS


5.拷贝配置文件

[root@localhost ~]#cp /usr/local/spine/etc/spine.conf.dist /usr/local/spine/etc/spine.conf


6.重启服务

[root@localhost ~]#service httpd restart

[root@localhost ~]#service snmpd restart

[root@localhost ~]#service mysqld restart


7.修改mysql的root密码

[root@localhost ~]#/etc/init.d/mysqld start

修改mysql root密码为123456

[root@localhost ~]#mysqladmin -u root password "123456"


登录mysql测试

[root@localhost ~]#mysql -uroot -p123456



8.配置并导入数据库

mysql> create database cacti default character set utf8;

mysql> GRANT ALL privileges ON cacti.* TO cacti@localhost IDENTIFIED BY ‘123456‘;

mysql> flush privileges;

[root@localhost ~]# mysql -uroot -p cacti</var/www/html/cacti/cacti.sql


9.修改php配置文件

[root@localhost ~]#vi /etc/php.ini

添加时区: date.timezone = Asia/ShangHai

定时计划任务(这里很重要,出错了可能会导致你的网页监控刷新不了)

*/1 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /var/log/cacti.log 2>&1 


10.修改cacti配置文件

[root@localhost ~]#vi /var/www/html/cacti/include/config.php

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cacti";

$database_password = "123456";

$database_port = "3306";

$database_ssl = false;


11.修改轮训器配置文件:

# vi /usr/local/spine/etc/spine.conf

DB_Host localhost

DB_Database cacti

DB_User cacti

DB_Pass 123456

DB_Port 3306

DB_PreG 0


12.设置selinux为disabled

[root@localhost ~]# cat /etc/selinux/config 

[root@localhost ~]#setenforce 0


13.访问web

http://192.168.88.150/cacti/

安装完成,默认用户名和密码是admin,第一次登录会要求更改密码


14.出图要等一会的

查看如果有图,没有曲线,重启apache,/usr/bin/php /var/www/html/cacti/poller.php

tail -f /var/log/messages


三、配置被监控Linux主机

1.在被监控主机上

[root@localhost ~]#egrep -v "^$|#" /etc/snmp/snmpd.conf 

com2sec notConfigUser default public 

group notConfigGroup v1 notConfigUser 

group notConfigGroup v2c notConfigUser 

view systemview included .1.3.6.1.2.1.1 

view systemview included .1.3.6.1.2.1.25.1.1 

access notConfigGroup "" any noauth exact all none none 

view all included .1 80 

syslocation Unknown (edit /etc/snmp/snmpd.conf) 

syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf) 

dontLogTCPWrappersConnects yes 

2.重启snmpd服务

[root@localhost ~]#service snmpd restart


四、图形界面配置可以参考下面链接

http://www.linuxidc.com/Linux/2012-07/66918.htm

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享


本文出自 “卡卡西” 博客,请务必保留此出处http://whnba.blog.51cto.com/1215711/1618485

Redhat 5.8 安装cacti 0.8.8c

标签:安装   redhat   cacti   

原文地址:http://whnba.blog.51cto.com/1215711/1618485

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!