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

catci的安装

时间:2015-04-13 13:02:03      阅读:379      评论:0      收藏:0      [点我收藏+]

标签:监控   cacti   

 

环境说明:

操作系统:CentOS6.5_x86_64

mysql5.17

cacti版本:cacti-0.8.8a

NET-SNMP版本:5.5

cacti:cacti-0.8.8c.tar.gz

 

 

1.安装以下组件或服务,使其开机启动

yum install httpd php php-mysql php-snmpmysql mysql-server net-snmp net-snmp-utils php-gd vixie-cron

yum install rrdtool --nogpgcheck

 

httpd:apache服务,提供web服务

php:php模块,支持动态网页

mysql:mysql服务,存储模板,用户等相关信息。

net-snmp:snmp服务,用来抓取被监控机的数据

rrdtool:存储数据

 

设置以下服务为开机启动

chkconfig mysqld on

chkconfig snmpd on

chkconfig httpd on

 

2.配置(apache配置,apachephp关联)

 

apache 的配置文件

/etc/httpd/conf/httpd.conf

DocumentRoot "/var/www/html"  #  找到数据目录

 

关联php模块

修改DirectoryIndex index.html DirectoryIndexindex.html index.php

并添加AddType application/x-httpd-php .php

 

测试phpapache关联是否成功关联

创建测试php页面test.php,并存放在网站主目录下,

<?php

phpinfo();

?>

 

在浏览器中输出http://ip/test.php 如果没有报错就表示关联成功

 

apachephp关联参考

http://blog.csdn.net/yincg/article/details/8782364

 

3.安装cacti

官网下载:wget http://www.cacti.net/downloads/cacti-0.8.8c.tar.gz

 

解压之后复制文件,目录到apache 根目录

mkdir /var/www/html/cacti

 

cd /home/software/cacti-0.8.8c

 

cp -rf  *  /var/www/html/cacti/

 

创建数据库:

mysql> create database cacti defaultcharacter set utf8;

 

导入数据cacti数据:

mysql> mysql  -uroot -ptest@123 cacti <  /var/www/html/cacti/cacti.sql

mysql> GRANT ALL ON cacti.* TOcacti@localhost IDENTIFIED BY ‘cacti‘;

mysql> flush privileges;

 

修改配置文件:

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

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cacti";

$database_password = "cacti";

$database_port = "3306";

 

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

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cacti";

$database_password = "cacti";

$database_port = "3306";

 

useradd cacti  :添加cacti 用户

添加权限:

cd /var/www/html/cacti 

chown -R cacti rra/ log/

 

 

 

4.配置snmp使可以监控本机(被监控机上安装)

yum -y install net-snmp net-snmp-utils

 

编辑snmp配置文件/etc/snmp/snmp.conf

 

修改:

com2sec notConfigUser  default      public

改为:

com2sec notConfigUser  监控主机的ip       public

 

修改:

access notConfigGroup ""     any       noauth    exact systemview none none

改为:

access notConfigGroup ""     any       noauth    exact all none none

 

去掉这句的注释

#view all   included  .1                               80

 

重启snmp服务并测试

service snmpd restart

 

5.安装spine:提升监控效率

http://www.cacti.net/downloads/spine/

 

#tar xf cacti-spine-0.8.8a.tar.gz

# cd cacti-spine-0.8.8a

#./configure --prefix=/usr/local/cacti-spine

configure: error: Cannot find SNMPheaders.  Use --with-snmp= to specifynon-default path.

 

#yum -y net-snmp-devel

#./configure--prefix=/usr/local/cacti-spine

 

在安装cacti-spine过程中,configure编译时出现如下错误提示:

configure: error: Cannot find MySQLheaders.  Use --with-mysql= to specifynon-default path.

原来是找不到mysql头,原来是mysql-devel没有安装,于是先安装mysq-devel:

#yum -y mysq-devel

如果出现无法注册X86-64错误,升级gcc

#yum -y gcc

 

#Make && make install

#cd /usr/local/cacti-spine/etc/

#cp spine.conf.dist spine.conf

 

6.cacti故障排查:

检测被监控端是否可以与监控机通信。

snmpwalk -c public -v 2c 监控主机ipIF-MIB::ifHCInOctets

snmpwalk -v 2c -c public 监控主机ip if

检查rrd文件是否问nan

rrdtool fetch fxd-mdl11_traffic_in_365.rrdAVERAGE

故障排查:

http://blog.itechol.com/space.php?uid=33&do=blog&id=5100

 

cacti安装:

http://www.360doc.com/content/12/1120/16/834950_249119792.shtml

http://liyaoyi.blog.51cto.com/442933/846891

http://blog.chinaunix.net/uid-24727220-id-3025015.html

http://www.cacti.net/download_cacti.php

yum找不到包的解决方法:

http://mirrors.163.com/.help/centos.html

apachephp的关联(lamp环境搭建)

http://blog.csdn.net/yincg/article/details/8782364

Rrdtool: http://oss.oetiker.ch/rrdtool/pub/

Net-snmp: http://sourceforge.net/projects/net-snmp/files/net-snmp/5.6.2.1/net-snmp-5.6.2.1.tar.gz/download

 

 

 

 

本文出自 “SQLServer MySQL” 博客,请务必保留此出处http://dwchaoyue.blog.51cto.com/2826417/1631783

catci的安装

标签:监控   cacti   

原文地址:http://dwchaoyue.blog.51cto.com/2826417/1631783

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