Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4863801
  • 博文数量: 983
  • 博客积分: 8199
  • 博客等级: 中将
  • 技术积分: 12857
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-25 20:19
个人简介

脚踏实地、勇往直前!

文章分类

全部博文(983)

文章存档

2019年(73)

2018年(208)

2017年(81)

2016年(49)

2015年(50)

2014年(170)

2013年(52)

2012年(177)

2011年(93)

2010年(30)

分类: LINUX

2015-02-04 09:31:14

环境:
OS:Linux Redhat As 5
cacti-0.8.8c

#######################安装Apache#################################

1.下载httpd
到官网下载相应的版本,我这里下载的是httpd-2.4.12.tar.gz

2.创建apache的安装目录
[root@host01 soft]# mkdir -p /usr/local/apache2
[root@host01 soft]# tar -zxvf httpd-2.4.12.tar.gz
[root@host01 soft]# cd httpd-2.4.12
[root@host01 httpd-2.2.27]#./configure --prefix=/usr/local/apache2 --enable--module=so
[root@host01 httpd-2.2.27]# make
[root@host01 httpd-2.2.27]# make install

3.启动apache
[root@host01 bin]# /usr/local/apache2/bin/apachectl start
httpd: apr_sockaddr_info_get() failed for host01
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

解决办法,编辑httpd.conf,在最后添加如下行
ServerName 192.168.56.111:8080

[root@host01 conf]# /usr/local/apache2/bin/apachectl start
httpd (pid 19540) already running


4.自定义配置httpd.conf
Listen 8080  ##apache监听的端口号
ServerName 192.168.56.111:8080 ##对外访问的服务器和端口号
DocumentRoot "/myweb/site"        ## web发布的目录

    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all



#######################安装PHP#################################

1.官网下载安装介质
我这里下载的是php-5.5.21.tar.gz


2.创建php安装目录
[root@host01 dbdata]# mkdir -p /usr/local/php5

3.安装php
[root@host01 soft]# tar -zxvf php-5.5.21.tar.gz
[root@host01 soft]# cd php-5.5.21
[root@host01 soft]# ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/lib --enable-track-vars --with-xml --with-mysql --enable-sockets

 
Configuring SAPI modules
checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS... configure: error: You have enabled Apache 1.3 support while your server is Apache 2.  Please use the appropriate switch --with-apxs2

以上的错误按照如下修改
[root@host01 php-5.5.21]./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/lib --enable-track-vars --with-xml --with-mysql --enable-sockets
[root@host01 php-5.5.21]# make
[root@host01 php-5.5.21]# make install

4.配置php
[root@host01 php-5.5.21]# cp php.ini-development /usr/local/lib/php.ini

vi php.ini
启用如下的项
;extension=php_bz2.dll
;extension=php_mbstring.dll
;extension=php_mcrypt.dll
;extension=php_mysql.dll
;extension=php_mysqli.dll
;extension=php_oci8.dll
将前面的";"去掉,表示启用该项.


 #######################安装Cacti#################################
一、安装snmp相关服务
[root@host01 yum.repos.d]# yum install net-snmp net-snmp-devel net-snmp-libs net-snmp-utils
##安装snmp相关包
[root@host01 yum.repos.d]# chkconfig --level 35 snmpd on ##设置snmp服务自动启动
[root@host01 yum.repos.d]# service snmpd start           ##手工启动snmp
[root@host01 yum.repos.d]# vi /etc/snmp/snmpd.conf       ##编辑snmp.conf文件,内容如下
# First, map the community name "public" into a "security name"
#       sec.name  source          community
com2sec notConfigUser  127.0.0.1       public
##           incl/excl subtree                          mask
view all    included  .1                               80

把下面的#号去掉
#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc

把下面的语句
access notConfigGroup "" any noauth exact systemview none none
改成:
access notConfigGroup "" any noauth exact mib2 none none

修改完成保存后重启动snmpd服务
#/etc/rc.d/init.d/snmpd restart

二、安装rrdtool
(1) 检查依赖包
[root@host01 yum.repos.d]# yum install cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel pear pear-devel

(2) 源码安装rrdtool
我这里下载的是rrdtool-1.4.7.tar.gz
[root@host01 cacti]# mkdir /usr/local/rrdtool       ##创建rrdtool安装目录
[root@host01 cacti]# cd /soft/cacti
[root@host01 cacti]# tar -xzf rrdtool-1.4.7.tar.gz  ##加压缩rrdtool
[root@host01 cacti]# cd rrdtool-1.4.7
[root@host01 cacti]#./configure --prefix=/usr/local/rrdtool ##rrdtool安装到/usr/local/rrdtool目录
[root@host01 cacti]#make && make install

三、安装Cacti

1. 解压cacti,并移动到web目录下
[root@host01 site]# tar -xzf cacti-0.8.8c.tar.gz
[root@host01 site]# mv cacti-0.8.8c cacti

2.在MySQL中创建数据库cacti
create database cacti;
grant all on cacti.* to cacti@localhost identified by 'cacti';
grant all on cacti.* to cacti@'127.0.0.1' identified by 'cacti';
grant all on cacti.* to cacti@'192.168.56.%' identified by 'cacti';


3.安装cacti
进入目录
[root@host01 site]# cd cacti
导入初始化数据
/usr/bin/mysql -h 192.168.56.111 -uroot -pmysql cacti


4.编辑config.php
[root@host01 include]# cd /myweb/site/cacti/include
[root@host01 include]# vi config.php

填写将mysql服务器的配置信息
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "192.168.56.111";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";


5.加入定时任务
root用户下
crontab -e
*/5 * * * * /usr/local/php5/bin/php /myweb/site/cacti/poller.php>/dev/null 2>&1


6.配置cacti
在ie栏输入:http://192.168.56.111:8080/cacti/install/index.php









红色标示的是没有找到的路径,这里需要手工指定
RRDTool Binary Path:/usr/local/rrdtool/bin/rrdtool
PHP Binary Path :/usr/local/php5/bin/php



cacti默认管理员用户是:admin,密码:admin;这里输入点击“login(登陆)”


这里重新设置密码






 

安装过程中遇到的问题
1. Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /myweb/site/cacti/include/global_constants.php on line 165
修改php.ini,修改如下参数
date.timezone = PRC

2.有图像但是没有数据
[root@host01 cacti]# /usr/local/php5/bin/php /myweb/site/cacti/poller.php
检查是否有错误,如我这里就遇到这样的错误
PHP Warning:  PHP Startup: Unable to load dynamic library '/soft/php-5.5.21/ext/php_mysql.dll' - /soft/php-5.5.21/ext/php_mysql.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/soft/php-5.5.21/ext/php_mysql.dll' - /soft/php-5.5.21/ext/php_mysql.dll: cannot open shared object file: No such file or directory in Unknown on line 0

修改php.ini文件,确保如上的命令没有任何的错误。

3.crontab调度时间间隔
02/11/2015 11:08:00 AM - POLLER: Poller[0] WARNING: Cron is out of sync with the Poller Interval!  The Poller Interval is '60' seconds, with a maximum of a '300' second Cron, but 179 seconds have passed since the last poll!
02/11/2015 11:08:00 AM - SYSTEM STATS: Time:0.1501 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:1 RRDsProcessed:

将crontab的调度时间频率为1分钟。

以上的问题解决后,需要重新生成文件,删除$CACTI_HOME/rra下的文件,然后在web界面System Utlities-->Rebulid Poller Cache.


4.cacti监控数据是存在mysql中的,启动cacti之前需要启动mysql

mysql用户登录
mysqld_safe --defaults-file=/home/mysql/mysql_app/config/my.cnf

阅读(3779) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册