LinuMySQLCacti安装配置

上传人:xy****7 文档编号:45535143 上传时间:2018-06-17 格式:DOCX 页数:7 大小:22.59KB
返回 下载 相关 举报
LinuMySQLCacti安装配置_第1页
第1页 / 共7页
LinuMySQLCacti安装配置_第2页
第2页 / 共7页
LinuMySQLCacti安装配置_第3页
第3页 / 共7页
LinuMySQLCacti安装配置_第4页
第4页 / 共7页
LinuMySQLCacti安装配置_第5页
第5页 / 共7页
点击查看更多>>
资源描述

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

1、Linux_MySQL_Cacti 安装配置安装配置cacti 是一套开源的网络监控工具,可以监控主机的状态和负载情况, 添加相应的模板后,可以用来监控 apache 服务器和 mysql 服务器的运行状态, 我安装这个主要是为了监控 mysql 服务器的运行状态的。 cacti 的网站:http:/ 主机环境:CentOS 5.5 更新日期:20100717 mysql: mysql-5.0.77-4.el5_5.3 php: php-5.1.6-27.el5 apache: httpd-2.2.3-43.el5.centoscacti 安装时会要求一些组件,比如 snmp, php-xml

2、,php-ldap(可选), 这些倒不用太担心,因为安装 LAMP 环境的时候多少也装了一些, 即便没有,请使用 yum 命令,我感觉 centos 的这个还是挺好的, 虽然软件有时有些老了,但是还是可以用的。手动把 snmp 的相关程序装下, 不然最后首次配置的时候会找不到一些 snmpwalk,snmpget 什么的 roottigertall bin# rpm -qa|grep snmp php-snmp-5.1.6-27.el5 net-snmp-utils-5.3.2.2-9.el5_5.1 net-snmp-5.3.2.2-9.el5_5.1 net-snmp-devel-5.3.

3、2.2-9.el5_5.1 net-snmp-libs-5.3.2.2-9.el5_5.1 roottigertall bin# 如果以上组件有缺失,请使用 yum 自己安装下。 使用 yum 安装 cacti gaohutigertall $ sudo yum install cacti这个命令会自动安装相关的组件。1.php 配置要求配置要求gaohutigertall $ php -m 这个命令可以检查 php 安装了哪些模块。 要求 php 扩展支持中已经配置了 mysql.so,centos yum 默认环境下 httpd 的 conf 文件配置在 /etc/httpd/conf/h

4、ttpd.conf 默认的加载项(php,mysql)配置目录 /etc/httpd/conf.d。 roottigertall conf.d# ls bugzilla.conf manual.conf php.conf proxy_ajp.conf README ssl.conf welcome.conf cacti.conf perl.conf phpMyAdmin.conf python.conf squid.conf webalizer.conf roottigertall conf.d# 可以看到,很多 web 相关的配置都在这里。 php 的基础配置在 /etc/php.ini。r

5、oottigertall conf.d# cd /etc/php.d roottigertall php.d# ls dbase.ini gd.ini mcrypt.ini mysql.ini pdo_mysql.ini pgsql.ini xmlwriter.ini dom.ini ldap.ini mhash.ini ncurses.ini pdo_pgsql.ini snmp.ini xsl.ini eaccelerator.ini mbstring.ini mysqli.ini pdo.ini pdo_sqlite.ini xmlreader.ini roottigertall php

6、.d# php.d 目录下设置了一些 php 扩展组件的配置。 查看 mysql.ini,启用 extension=mysql.so 查看 snmp.in,启用 extension=snmp.so 如果要启用导入模板的功能,还要启用文件上传,在/etc/php.ini 中启用 file_uloads=on;注释以下,如果没有注释 session.save_path = /tmp;2.apache 配置要求配置要求在 apache 配置/etc/httpd/conf.d/php.conf 中, 检查一下语句是否启用,一般情况下, 应该是已经默认启用了的。 # PHP is an HTML-emb

7、edded scripting language which # attempts to make it # easy for developers to write dynamically # generated webpages. LoadModule php5_module modules/libphp5.so # # Cause the PHP interpreter to handle files # with a .php extension. AddHandler php5-script .php AddType text/html .php # # Add index.php

8、to the list of files that # will be served as directory # indexes. DirectoryIndex index.php3.mysql 配置要求配置要求请记得给 root 设置一个秘密,以保护自己安全,呵呵。可以使用如下的命令来更改 root 的密码:mysqladmin -user=root password somepasswordmysqladmin -user=root -password reload4.4.cacti 安装配置安装配置1.使用如下命令来安装 cacti,这个会自动安装需要的组件。 roottigertal

9、l php.d# yum install cacti2.创建 mysql 数据库 roottigertall php.d# mysqladmin -uroot -phandomse create cacti3.导入默认的 cacti 数据库 如果使用 yum 默认安装,创建数据库的脚本 默认在/usr/share/doc/cacti-0.8.7f/cacti.sql roottigertall php.d# cd /usr/share/doc/cacti-0.8.7f/执行创建数据库的命令 roottigertall 0.8.7.f# mysql -uroot -phandomse cacti

10、 GRANT ALL ON cacti.* TO cactiuserlocalhost IDENTIFIED BY password;刷新权限 mysql flush privileges;5.编辑 cacti 配置,做数据连接设置 roottigertall include# vi /usr/share/cacti/include/config.php 这里有 cacti 连接使用的数据库类型,用户名,密码信息/* make sure these values refect */ /* your actual database/host/user/password */ $database_

11、type = “mysql“; $database_default = “cacti“; $database_hostname = “localhost“; $database_username = “cactiuser“; $database_password = “cactiuser“; $database_port = “3306“;/* Default session name - Session name must */* contain alpha characters */ #$cacti_session_name = “Cacti“;把上述配置按照自己的需要设置6.目录权限设置

12、 roottigertall include# cd /usr/share/cacti/ roottigertall cacti# ll rra lrwxrwxrwx 1 root root 18 Jul 17 15:07 rra - /var/lib/cacti/rra roottigertall cacti# ll log lrwxrwxrwx 1 root root 15 Jul 17 15:07 log - /var/log/cacti/从上述可以看到,rra 实际上是 var/lib/cacti/rra 的一个软链接, log 则是/var/log/cacti 的一个软链接。 更改上

13、述目录的权限,按需要更改属主,下面生成数据会用到这个用户。 roottigertall cacti# chown -R gaohu rra/ log/7.配置自动作业时间 编辑 crontab。 roottigertall log# crontab -e增加如下内容, */5 * * * * php /usr/share/cacti/poller.php /dev/null 2&1注意:注意: 这个地方不能按照官方文档来,不能加上执行的用户名, crontab 根本没有执行用户这个参数的,官方文档是这样的: */5 * * * * gaohu php /usr/share/cacti/poll

14、er.php /dev/null 2&1按照这个设置,会报错的: 07/17/2010 10:59:57 PM - POLLER: Poller0 WARNING: Cron is out of sync with the Poller Interval! The Poller Interval is 300 seconds, with a maximum of a 300 second Cron, but 419 seconds have passed since the last poll!会告警说设置的是 300 秒,结果 400 多秒了还没有执行过。以上内容意思是,每隔五分钟,执行下

15、php 脚本,统计下数据。一个由此引发的问题见最后。8.登录服务器 登录 http:/your-webserver/cacti 初始登录时,用户名和密码为 admin,登录后,会要求立即切换密码。4.Spine 安装配置(可选)安装配置(可选)spine 是一个基于 C 语言的,非常快速的轮询引擎。它是默认的 cmd.php 的可选替代。 如果决定使用它的话, 需要自己来显式的安装和配置。cacti 本身并不包含该引擎。 安装 Spine 的最简单的方法就是使用 rpm 或者使用 ports。 如果使用 yum 来进行安装,需要添加 rpmforge 的软件仓库。 如果使用源码,可以在 cacti 的主站下载源码包。下载的地址为: http:/ cacti 网站下载 spine 源码包2.解压到本地目录,编译安装 安装 spine 需要有 net-snmp-devel、mysql、mysql-devel、openssl-devel 支 持, 请查看下是否已经安装。 使用以下命令来编译安装: tar xvzf cacti-spine-0.8.7g.tar.gz cd cacti-spine-0.8.7g ./configur

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

当前位置:首页 > 行业资料 > 其它行业文档

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