cacti故障解决php
cacti对于运维者而言,是一套基于PHP,MySQL,SNMP及RRDTool开发的网络流量监测图形分析工具,她的用途很明显,能够很方便的帮助运维者监控网络环境中的服务器、设备等,而且也可以实现经过邮件、飞信、msn告警的功能,本篇就不是详细介绍cacti的安装、使用、告警实现了,能够参照附件,有完整的安装及使用过程。
1、首先针对lamp源码环境
mysql为源码,须要用cmake来编译,
cmake安装
./configure
make && make install
mysql编译安装
[root@host ~]#tar -zxvf mysql-5.5.30.tar.gz -C /usr/local/
[root@host ~]# cd /usr/local/mysql-5.5.30/
[root@host mysql-5.5.30]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ - DMYSQL_DATADIR=/mysql/data/ [为mysql的数据目录,初始化时要经过 --datadir指明] \
-DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 \
-DDEFAULT_CHARSET=utf8 -DEXTRA_CHARSETS=all \ -DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_DEBUG=0
[root@host mysql]#make && make install 编译过之后,自行参照INSTALL-BINARY来初始化。
php的源码编译要指定 --enable-sockets 选项,不然,cacti将没法运行 参看《lamp×××》
2、错误时区问题
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/usr/local/apache/htdocs/cacti/include/global_constants.php on line 165
在源码安装php时指定配置文件的路径
--with-config-file-path=/usr/local/php/etc
而后从php的源码包拷贝php.ini-development或php.ini-production 命名为php.ini
[root@localhost php-5.4.8]# pwd
/usr/local/src/php-5.4.8
[root@localhost php-5.4.8]# cp php.ini-production /usr/local/php/etc/php.ini
在php.ini中加入 date.timezone = "Asia/Shanghai"
或在cacti的include/config.php中添加
date_default_timezone_set("Asia/Shanghai"); //实验中这种修改方式成功
3、在安装插件thold时错误
Fatal error: Call to undefined function define_syslog_variables() in /usr/local/apache/htdocs/cacti/plugins/thold/includes/settings.php on line 91
PHP5.3开始便废除一些较旧的函数,当使用这些函数时,会遇到 E_DEPRECATED 错误。
define_syslog_variables(),该函数初始化全部与 syslog 相关的变量。该函数不是必需的,由于它定义的常量已经被全局定义。废除这个函数调用应该是有必要的。
解决方法:
编辑 cacti 目录下 plugins/thold/includes/settings.php,并注释掉91该行。问题解决。
4、没法生成rrd文件
1)rrdtool的版本选取是否正确,
2)目录log、rra权限问题
3)mysql的权限问题,查看cacti的日志,好比权限问题
好比cacti用户是否已经受权成功,源码安装mysql时注意数据目录的全部者,等等了,
让咱们共同努力让cacti的使用再也不繁琐,跟贴,共同建立cacti的故障手册。。。