cacti中文版安装配置

上传人:第*** 文档编号:32683384 上传时间:2018-02-12 格式:DOCX 页数:10 大小:170.37KB
返回 下载 相关 举报
cacti中文版安装配置_第1页
第1页 / 共10页
cacti中文版安装配置_第2页
第2页 / 共10页
cacti中文版安装配置_第3页
第3页 / 共10页
cacti中文版安装配置_第4页
第4页 / 共10页
cacti中文版安装配置_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《cacti中文版安装配置》由会员分享,可在线阅读,更多相关《cacti中文版安装配置(10页珍藏版)》请在金锄头文库上搜索。

1、Cacti 中文版安装配置 Cacti 中文版安装配置Cacti 是一款优秀的开源监控软件,使用 php 实现,它的主要特点是使用 snmp 服务获取数据,然后用 rrdtool 存储和更新数据,当用户查看数据的时候,rrdtool 生成图表呈现给用户。mysql 数据库用于存储变量并进行调用。mysql 数据库并不存储 snmp 捕获到的数据,snmp捕获到的数据,存在于 rrdtool 生成的 rrd 文件中,这些文件位于 cacti 目录下的 rra 目录中。本文主要介绍 cacti 中文版的安装,配置,cacti 插件的安装,配置。英文版的安装跟中文版大同小异,但是中文版会麻烦点,所以

2、就以中文版为例。系统:Centos5.6 x386软件:cacti-0.8.7e本文档提供 pdf 版本下载,祥见文章尾部。一、 准备软件的安装由于 cacti 使用 php 来实现,通过 WEB 来管理,使用 snmp 来捕获数据,使用 rrdtool 来生成图表,使用 mysql 来存储变量,因此需要先安装这些软件,直接使用 yum 进行安装即可,共需安装以下 rpm 包:httpd/mysql-server/php/php-mysql/rrdtool/gd/net-snmp/php-snmp/net-snmp-utils/net-snmp-devel/mysql-devel/openss

3、l-devel各个 rpm 包的作用为:httpd WEB 服务器 apachemysql-server 数据库 mysqlphp cacti 使用 php 来实现php-mysql php 支持 mysqlrrdtool 用来生成 cacti 图像gd rrdtool 绘制图像需要的图形库php-snmp php 支持 snmpnet-snmp-utils 一些 snmp 的扩展命令,如:snmpwalk、snmpget 等,cacti 需要net-snmp-devel/mysql-devel/openssl-devel cactid/spine 需要安装 rpm 包:#yum httpd

4、mysql-server php php-mysql gd net-snmp php-snmp net-snmp-utils net-snmp-devel mysql-devel openssl-devel由于 centos 的标准组件中是不带 rrdtool 的,因此我们需要添加一个 dag 的 yum 源,以安装 rrdtool。修改/etc/yum.repos.d/CentOS-Base.repo,#vi /etc/yum.repos.d/CentOS-Base.repo在其末尾追加dagname=Dag RPM Repository for Red Hat Enterprise Lin

5、uxbaseurl=http:/apt.sw.be/redhat/el$releasever/en/$basearch/daggpgcheck=1gpgkey=http:/ yum#yum clean all#yum list现在就可以安装 rrdtool#yum install rrdtool设置开机自启动#chkconfig httpd on#chkconfig mysqld on#chkconfig snmpd on二、 MySQL 数据设置由于 cacti 依靠 mysql 来存储必要的变量,我们有必要对 MySQL 做些设置。启动并初始化 mysql 数据库#service mysq

6、ld start为 root 用户设置密码(以 linuxpad 为例) ,并更改登录权限,默认密码为空#mysql u root p 回车后输入密码(空)mysqluse mysql;mysqlupdate user set password=password(“linuxpad”) where user=”root”; mysqlgrant all privileges on *.* to rootlocalhost identified by “linuxpad” with grant option;mysqlflush privileges;添加 cacti 库和 cacti 用户,并

7、为其设置权限mysqlcreate database cacti default character set utf8; /数据库字符集设置utf8,否则乱码mysqlgrant all privileges on cacti.* to cactilocalhost identified by “linuxpad” with grant option;mysqlflush privileges;三、 安装 Cacti下载 cacti-0.8.7e-cn-utf8.tar.gz,地址为http:/ (这个链接是 tar.gz 格式的,请下载后更改文件格式),假设下载目录为/opt/soft,下面

8、相同#cd /opt/soft#tar zxvf 090815172648.tar.gz#mv cacti-0.8.7e-cn-utf8 /var/www/cacti修改配置文件#vi /var/www/cacti/include/config.php修改内容如下$database_type = mysql;$database_default = cacti;$database_hostname = localhost;$database_username = cacti;$database_password = linuxpad;关于 cacti 添加用户,网上常见的做法是添加一个 cact

9、i 的用户,并更改 rra 和 log 目录属主。经过本人测试这里并不需要添加 cacti 用户并更改 rra 和 log 的属主,直接使用 root 即可。原因是因为官方的安装文档上使用的是 FreeBSD,在计划任务那步使用的是:*/5 * * * * cacti php /var/www/cacti/poller.php &/dev/null,使用用户 cacti 来执行任务。但是 centos 并不是识别这个 cacti 参数,因此也就无需使用 cacti 来执行任务,我们直接使用root 来执行任务就 OK 了,于是不用更改目录权限,crontab 内容为*/5 * * * * ph

10、p /var/www/cacti/poller.php /dev/null &21还有另外一种的解决方案,就是添加一个 cacti 用户,更改 rra 和 log 目录属主为 cacti,然后在 cacti 用户环境下设置 crontab,内容为*/5 * * * * php /var/www/cacti/poller.php /dev/null &21这样就能实现 crontab 计划是由 cacti 用户来执行的了。创建并编辑 apache 的 cacti 配置文件#vi /etc/httpd/conf.d/cacti.conf内容如下:Alias /cacti /var/www/cact

11、iDirectoryIndex index.phpAllowOverride allorder deny,allowallow from allphp_flag magic_quotes_gpc onphp_flag track_vars on导入数据库#mysql u root p cacti /dev/null &21添加中文字体支持,否则 Cacti 图像内会没有任何内容。CentOS 下直接 yum 安装中文支持#yum install fonts-chinese打开 Cacti,控制面板 -配置- 设置-路径:将 RRDTool 默认字体路径设为/ usr/share/fonts/c

12、hinese/TrueType/ukai.ttf配置无误,会显示文件已找到。四、 配置本机 snmp编辑 snmp 配置文件 /etc/snmp/snmp.conf修改:com2sec notConfigUser default public改为:com2sec notConfigUser 127.0.0.1 public修改:access notConfigGroup any noauth exact systemview none none改为:access notConfigGroup any noauth exact all none none去掉这句的注释#view all incl

13、uded .1 80重启 snmp 服务并测试#service snmpd restart# snmpwalk -v 1 -c public localhost IP-MIB:ipAdEntIfIndex IP-MIB:ipAdEntIfIndex.127.0.0.1 = INTEGER: 1IP-MIB:ipAdEntIfIndex.xxx.xxx.xxx.xxx = INTEGER: 2IP-MIB:ipAdEntIfIndex.xxx.xxx.xxx.xxx = INTEGER: 3显示以上信息,则 snmp 配置成功,xxx.xxx.xxx.xxx 会根据你本机的 IP 信息配置而不同

14、。图 1如果配置正确,隔几分钟,我们的 cacti 就会有数据了,如图 2,你也可以手动执行以下命令手动生成 rrd 图像#/usr/bin/php /var/www/cacti/poller.php &/dev/null图 2五、 安装 Spine由于默认 cmd.php 来轮询数据,速度会很慢,特别是在监控节点比较多的情况下,cmd.php就更显不足了,因此我们采用 Spine 来轮询数据。cacti-spine 是一个由 C 语言开发的,用于替代 cmd.php 的快速获取速度的引擎。下载地址:http:/ spine 之前请确保它所依赖的包 net-snmp-devel、mysql-d

15、evel 、openssl-devel 都已安装完毕。以下是安装步骤#cd /opt/soft#wget http:/ zxvf cacti-spine-0.8.7e.tar.gz#cd cacti-spine-0.8.7e#./configure#make & make install编辑 spine 配置文件#vi /usr/local/spine/etc/spine.conf修改内容如下:DB_Host localhostDB_Database cactiDB_User cactiDB_Pass linuxpadDB_Port 3306将 spine 启动并设置开机自启动#/usr/local/spine/bin/spine#ech

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 中学教育 > 职业教育

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号