Chinaunix首页 | 论坛 | 博客
  • 博客访问: 144369
  • 博文数量: 31
  • 博客积分: 2075
  • 博客等级: 大尉
  • 技术积分: 340
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-29 10:06
文章分类

全部博文(31)

文章存档

2017年(3)

2014年(1)

2013年(1)

2011年(9)

2010年(14)

2009年(3)

我的朋友

分类: LINUX

2011-12-15 11:38:41

前言:】 本篇博文主要是记录个人在安装配置实践过程中所遇到的问题 , 以备后忘。 针对同一种报错提示,可能有很多种原因,对应的,自然也就有不同的解决办法。每个人所处系统环境千差万别,不能一概而论。在安装实施过程中一定要根据错误提示找出对应的解决方法。这里所作的记录仅供参考
本文最终实践成功的各种主要  工具版本如下(全部编译安装):
Nagios 3.3.1
Cacti-0.8.7i-PIA-3.1 、Cacti-spine-0.8.7i
Php 5.3.7
MySQL-5.1.54 
Apache 2.2.21
Net-Snmp-5.7.1

PART I CACTI 

-----------------------------------------------Section A----Cacti------------------------------------
Platform Specification :
Cacti安装:RHEL5.3(Tikanga)_32bit ;
被监控机:Solaris 10 5/09 s10x_u7wos_08 X86


cacti的安装、使用 : http://surpassdream.blog.51cto.com/1347340/286728

DownLoad rrdtool-1.4.5.tar.gz From:

安装问题集锦 :
【1、】对于如上链接没提到的cairo 编译失败问题,
提示:" no (requires pixman-1 >= 0.18.4 )
configure: error: mandatory image surface backend feature could not be enabled
的解决方法是:在安装完pixman-0.18.4后,在cario源码目录里./configure之前,
执行 : export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
原因 :
The problem is that cairo is trying to use pkg-config to find pixman, and even though most packages install themselves into /usr/local/lib by default, pkg-config does not look into /usr/local/lib by default.
So you need to tell pkg-config about that by setting the environment variable before you call configure
【2、】编译安装cacti-spine-0.8.7i时报错:
checking for snmp_timeout in -lsnmp... no configure: error: Cannot find UCD-SNMP libraries(snmp)
安装net-snmp-devel.i386可解决。继续编译又报错:
checking for mysql_init in -lmysqlclient_r... no configure: error: MySQL libraries not found
可安装 MySQL-shared-compat-6.0.9-0.rhel5.i386.rpm  
下载MySQL-shared-standard-5.0.21-1.rhel4.i386.rpm安装解决。
之后再./configure -with-mysql=/usr/include/mysql/ -with-snmp=/usr/include/net-snmp/;make&make install
额外提一下,对于这里遇到的问题,网上看到的解决方法有 修改Makefile、删除并重装spine、configure时只跟参数-with-static=/usr/local/lib ;本文安装时尝试过这些方法统统没用.

安装完成后,在浏览器中输入地址 http://【youIP】/cacti# " 当安装界面出现后(如果没出现,看是不是selinux的原因. 是就禁用并重启即可看到安装界面),按照提示一步步安装,最后登陆。
Cacti 默认登陆的用户名与密码都是 admin .


SNMP配置 : ——Linux

----------------------------------------------- Section  B----Net-SNMP----------------------------------------

本文在SUN上编译安装snmp-5.7.1 , 同时编译安装OpenSSL-0.9.8i 以及beecrypt-4.1.2.tar.gz
可参考:http://michaels.blogbus.com/logs/29901067.html
A1、】先移除自带的snmp包:
1、disable掉snmpdx、sma(自带的netsnmp一定要关闭)、dmi(snmp的子进程)、seaport(snmp相关进程)
2、再rm掉 SUNWjsnmp、SUNWmibii(snmp agent daemon)
A3、】编译SNMP报错:
*** Error code 1 
make: Fatal error: Command failed for target `libnetsnmp.la' 
Current working directory your working directory
*** Error code 1 
make: Fatal error: Command failed for target `subdirs' 
查到网上一德国佬回复之后搞定:
Make sure you have /usr/ccs/bin/ar installed and in your PATH before running configure.
所以在编译配置前一定要设置
PATH=/usr/bin:/usr/local/bin:/usr/ucb:/etc:/usr/sbin:/usr/bin:/usr/sfw/bin:/usr/ccs/bin:/opt/
之后再/usr/ccs/bin/make  并 install.
A4、】beecrypt-4.1.2.tar.gz
/usr/sfw/bin/wget
configure后报错:
config.status: executing mpopt.x86 commands
./config.status: line 1414: m4: command not found
提示找不到m4, 设置PATH 包含/usr/ccs/bin/ 即可
A5、】编译安装OpenSSL-0.9.8i (download OpenSSL-0.9.8i from  " "
make报错:   *** Error code 1
make: Fatal error: Command failed for target `cryptlib.o'
make: Fatal error: Command failed for target `build_crypto'
对于这种报错提示,有很多种原因。自然就有各种不同的解决方法. 一定要根据自己编译时的错误提示找解决方法.
最后才发现  ./config 结果最后一行输出是Configured for solaris64-x86_64-gcc. 而此处平台是32bit.
Google从 看到解决
We are building a 32-bits version; force Configure to do so as we are on a 64bit platform:
./Configure solaris-x86-gcc --prefix=/usr/local/${PREFIX} shared -R/usr/local/${PREFIX}/lib

----------------------------------------------- Section  C----Appendix---------------------------------

appendix1、】配置完成后/usr/local/bin/snmpwalk -v 1 -c public localhost. 报错:
ld.so.1: snmpwalk: fatal: libgcc_s.so.1: open failed: No such file or directory
ldd 查看 snmpwalk 可看到 libgcc_s.so.1 =>         (file not found)
解决:LD_LIBRARY_PATH=/usr/local/lib;export LD_LIBRARY_PATH
appendix2、】/usr/local/sbin/snmpd 启动SNMP 报错:
ld.so.1: snmpd: fatal: /usr/local/lib/libnetsnmp.so.30: unknown file type
发现/usr/local/lib/libnetsnmp.so.30 链接到同目录下的libnetsnmp.so.30.0.1 ,而libnetsnmp.so.30.0.1大小为0的空文件,所以报错。Net-Snmp安装成功后, 会在执行编译安装任务的目录下生成一个新的libnetsnmp.so.30.0.1  ,find找到 并替换/usr/local/lib/下的空文件。
appendix3】用snmpconf生成snmpd.conf模板后cp到/usr/local/etc/snmp/, 编辑相关section内容.
1、/usr/local/httpd/bin/apachectl start
 httpd: could not open document config file /etc/apache/httpd.conf
将/etc/apache/httpd.conf-example  copy 成 /etc/apache/httpd.conf, 再  start
2、/usr/local/sbin/snmpd start 默认启动Agent 161端口
appendix4CACTI没有显示图像,rra目录下没有文件生成!权限、PATH、snmpwalk都没问题。
发现是spine链接不上mysql.  手动执行能连上,spine死活连不上,
mysqlcheck --auto-repair  --user=cactiuser --databases cactidb  --password=password 也都是OK
提示:SPINE: Poller[0] FATAL: Spine Encountered a Segmentation Fault (Spine parent)
调试,php -q /var/www/html/cacti/poller.php --force --debug 同样报如上错误,同时刷屏提示Waiting on 1 of 1 pollers.
cacti官网论坛老外说用新版本的spine解决这个问题. 对已安装的spine打相应的补丁. 由于本文安装时已经用的是最新版0.8.7i 所以没做什么操作,后来又发现老外有说升级php和mysql能解决,待用epel库yum升级完后仍然报同样错误. 折腾了2天, 最终实在没法 重装了spine 结果就好了. (所以这里建议大家在安装spine前用最新的mysql和php,本文升级到mysql5.5)
1、升级mysql可参考 和http://greybeard.blog.51cto.com/3221098/663784 这两个链接. 升级完成php后,
cactilog会报错:.......You are *required* to use the date.timezone setting or the date_default_timezone_set() function....... 提示说时区不对需要设置,在php4的版本没有时间区域的设置 php5的版本开始引入,PHP所取的时间是格林威治标准时间,和你当地的时间会有出入。
解决:
【step1、】在/var/www/html/cacti/lib/functions.php文件中,在页头使用date_default_timezone_set()设置默认时区为北京时间,即 

date_default_timezone_set("PRC"); 
?> 
step2、php.ini中设置date.timezone的值为PRC,设置好以后的为:date.timezone=PRC,同时取消这一行代码的注释
appendix5】没图显示.  log有PM - POLLER: Poller[0] Maximum runtime of  'No.' seconds exceeded. Exiting.  
解决:按照设置cacti  poller 的执行参数Maximum Threads per Process
Appendix6
本文前面部分安装的cacti-0.8.7i ,后来在结合nagios时发现需要cacti-plugin-architecture. 而0.8.7i版本没有单独的plugin,而是将PIA与cacti合并一起以cacti-0.8.7i-PIA-3.1发布, 安装后cacti后PIA自会工作. 所以覆盖老版本安装。完成后,出现了很多问题. 
索性再次重新全搞了一遍,这次 编译安装apache 2.2.21 (released 2011-09-13)  和  php5.3.7,而不用yum来装.  
需要提到的是编译安装后的apache配置文件处理和之前的实施有所不同.  
另外 , 如果安装完成后登陆cacti console时:
Error
The following PHP extensions are missing:
    * sockets
Please install those PHP extensions and retry
说明在安装php时没有配置socket支持. 此时php -m查看没有socket模块被加载. 

PART II NAGIOS

Nagios简介
Cacti的monitor插件,可提供更简略、直观的设备状态图示 ;
 thold插件,提供设备异常预警功能,并且也可以支持 msn,fetion,email,并且能够自己创建模版,例如可以定义流量比如在10M-100M之间是正常,超过这个区间就进行报警等等。
而Nagios监控服务器的状态很强大,并且报警功能也很不错,但对像流量这样的持续数据的展现能力却比较弱,虽然有类似PNP这样的插件可以对数据进行存储展现,但在看习惯Cacti的图后,PNP这样粗燥的图就很难接受了,因此整合Nagios和Cacti,能将点状态和线状态都清晰的展现。cacti本身的thold的插件也可以提供报警功能,这个也是非常不错的。那么为什么要引进nagios呢,Cacti所获取的信息都是通过snmp协议进行的,通过snmp可以获取磁盘信息,流量信息,负载信息等。如果需要探测一个http服务是否正常的话,Nagios就是最好的解决办法,并且nagios的检测插件非常丰富,可以直接拿来简单配置一下command就可以用了。因此在监控报警方面,cacti和nagios结合起来是比较好的选择。说整合其实只是表面的,cacti和nagios还是以他们原来的方式进行工作,ndo负责将nagios收集的数据存在数据库中,cacti的npc插件会从数据库中取数据在cacti的npc标签中来展现。

详细可参考:

本文参照最后一个链接编译安装Nagios3.3.1,由于之前编译安装php,此处不用再安装php-devel的rpm包,额外提一下:
【1、】json编译安装完成后有json.so文件生成。由于个人系统环境或安装php的方式、版本差异,不一定都有/etc/php.d/目录,也并不一定非要生搬硬套的新建json.ini文件来添加json.so扩展. 说到底这些操作的实质无非就是让php加载json扩展模块.  php加载extension模块的路径通过其配置文件php.ini中extension_dir参数来指定.只要保证这个参数值目录下存在有json.so文件即可. 之后用php -m查看是否加载成功.

【2、】装完后,要把nagios页面文件nagios.conf 中从ScriptAlias到文件结尾的内容追加到apache配置文件中. 确保以web方式访问nagios web console时需要用指定的密码进行认证,提高安全性. (自行设置; 本文用nagiosadmin /123123)。
更详细步骤可同时参考: http://blog.appleandroid.com/post/24/

【3、】至于重启Nagios报错提示Starting nagios:This account is currently not available. 因为编译安装时默认创建的nagios用户是没有登陆权限的. 在passwd文件中把/sbin/nologin改成/bin/bash或其它给予它一个任意shell即可.

【4、】在被监控机(本文是SUN X86)上安装nrpe-plugin和nrpe-daemon 、nagios-plugins ; 在nagios监控机上安装nrpe-plugin(Nagios监控机上的nrpe插件是向被监控机上的nrpe-daemon发命令的工具 )。可参考:  
 
fengqixuan/blog/item/d27a23f3d55e1243342acc0c.html —> [第五部分:监控其它机器的本地信息
本文参照第一个链接。额外提一下, nagios-plugins时如果出现:  make: Fatal error: Command failed for target `check_mysql-check_mysql.o' ;  解决: configure时--with-mysql=DIR(find找到DIR值)或 --without-mysql解决. 

如下5、6两点是参考如上第3个链接(hi.baidu..)实施过程中有所出入的问题记录
【5、】nagios的配置 : 
没有对应的cfg配置文件就在相应的objects目录下创建并编辑. 注意修改属组和权限。对于产生的如下报错:
Error: Service notification command 'notify-by-email' specified for contact 'admin' is not defined anywhere!
Error: Host notification command 'host-notify-by-email' specified for contact 'admin' is not defined anywhere!
实质意思是说在contacts.cfg中定义了要执行的命令名称但又没有在commands.cfg中定义实际要执行的命令语句本身.这是因为链接中提到的contacts.cfg编辑时,对于service_notification_commands 和host_notification_commands这两项参数的值(即命令名称)不正确,需要改成与commands.cfg中的相应命令名一致就行了。要不然-v 检查nagios配置时会报错,也会重启失败。

【6、】第一次执行/usr/local/apache/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users 
 -c 参数表示新建文件存放创建的帐号和口令. 增加Nagios管理员帐号时再次执行htpasswd时不要再跟 -c 参数, 要不然会替换掉文件中之前创建的帐号.

【7、】nagios 执行check_disk时报 “NRPE: Command 'check_disk' not defined”,这个提示很明显,直接在被监控机nrpe.cfg中添加 command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% 一行就行. 实质就是让nrpe-daemon能接受并识别nagios监控机发来的check_disk插件相应命令请求

【8、】启动ndo2db守护进程时:Could not bind socket: Address already in use. 
解决 : Remove the ‘ndo.sock’ and restart the process.

【9、】安装配置好后,遇到了没有显示任何数据的问题,host, hostgroup, service, servicegroup等等都看不到.
说明ndo没有成功将nagios数据存储到mysql db中,npc没有数据源.  
检查nagios.cfg、ndo2db.cfg、ndomod.cfg配置都没错误.(ndomod通过nagios得到数据,ndo2db把数据写入mysql),
对于ndo2db.cfg文件中的:
ndo2db_user:运行nagios的用户名
ndo2db_group:运行nagios的组
db_user & db_pass: 授权访问ndodb数据库的用户名和密码
db_name : "前面安装cacti时创建的db name"
这里特别说明一下, 由于本文是配合Cacti使用, 所以这里的user和pass必须和之前创建的cacti db的用户、密码、dbname相同。所谓的nagios和cacti的整合就体现在这里; 如果不结合cacti使用,自然就要新建ndo自己的db及相应的帐号.可参考 :   http://freeze.blog.51cto.com/1846439/386828
由于ndo没能成功保存数据到数据库,查看nagios.log看到有:
ndomod: Could not open data sink!  I'll keep trying, but some output may get lost...
解决:后来发现是ndo2db和ndomod2个配置文件属主没搞对. 重新设置后依然报错,只是多了如下错误提示:
ndomod: Still unable to connect to data sink.  0 items lost, ××× queued items to flush.  最后google找到把socket type从tcp改回默认的unix 类型后解决. 
如果指定为tcp, 就要在ndomod.cfg文件中通过output参数指定ip ,如果指定为unix,就要指定unix域接口文件(就是ndo2db.cfg中的socket_name值)。这个在配置文件中说得很清楚。

【10、】接第9点,cacti npc中仍然无host显示. syslog中有: 
ndo2db-3x: mysql_error: 'Unknown column 'long_output' in 'field list''
修改mysql中的表结构:
mysql -u cactiuser -p
use cactidb
alter table npc_eventhandlers add long_output TEXT NOT NULL default '' after output; 
alter table npc_hostchecks add long_output TEXT NOT NULL default '' after output; 
alter table npc_hoststatus add long_output TEXT NOT NULL default '' after output; 
alter table npc_notifications add long_output TEXT NOT NULL default '' after output; 
alter table npc_servicechecks add long_output TEXT NOT NULL default '' after output; 
alter table npc_servicestatus add long_output TEXT NOT NULL default '' after output; 
alter table npc_statehistory add long_output TEXT NOT NULL default '' after output; 
alter table npc_systemcommands add long_output TEXT NOT NULL default '' after output; 

【11、】问题依旧,
web 访问nagios :  http://yourip/cacti/plugins/npc/npc.php?module=servicegroups&action=getHostStatusPortlet
看有异常 Doctrine_Connection_Exception' with message 'Couldn't locate driver named mysql'  说明php没有加载mysql驱动(php_mysql.so) , 下载PDO_MYSQL-1.0.2.tgz编译安装又报 make: *** [pdo_mysql.lo] Error 1, 需要安装mysql对应版本的mysql-devel包。

最后生成php_mysql.so后,它妈的php又死活无法动态加载.  我操!   

分析了一下原因,是因为此前安装的MySQL都是用yum装的, 而本文进行到现在,安装的php和apache却是编译安装,死活加载不上问题就出在编译安装php的时候通过--with-mysql 指定的mysql安装路径不对,yum安装完MySQL后产生的include、lib 等 几个目录默认全在/usr下,而此前--with-mysql指定的又是/usr/include/mysql. 使得php无法加载.
这里理论上有两种方法:
a 、重新编译安装php , 带上选项--with-mysql= 指定mysql的正确安装路径为/usr
b、在安装php_mysql.so的过程中,执行phpize(检测当前系统环境,建立一个configure文件)时带上选项--with-mysql =/usr. 意图让生成的php_mysql.so被当前的php版本所识别而能成功Load.

这里采用方法a .  (后来才发现这个选择是多么愚蠢,因此多耗费近一天时间来解决随之产生的问题).  
到php源码目录,修改之前第一次安装时生成的config.nice,使--with-mysql=/usr, 并make&make install. 结果可能是因为/usr目录东西太多, 不仅仅包含有mysql的东西, 因指定的范围太大而造成php都出问题. 

没办法,把通过yum安装的MySQL包全灭了,把编译安装完的php所有文件也全灭了。再次重新编译安装mysql到/usr/local/mysql目录下,并在再次安装php时 使--with-mysql=/usr/local/mysql. 
之后参考 : http://lovemjd.blog.51cto.com/1373993/300981 , 就能成功load 了.

编译安装mysql出错 : checking for termcap functions library... configure: error: No curses/termcap library found
就安装 ncurses.version. tar.gz, 安装ncurses- version .tar.gz又出错:
/bin/sh: -I../c++: not found
make[1]: *** [../objects/cursesf.o] Error 127  .   就yum安装gcc-c++

对于启动或停止mysql出错 Manager of pid-file quit without updating file,一般来讲都是其配置文件my.cnf 的问题

想想为了一个鸟扩展,近在咫尺的成功被打破反而得重头来编译安装mysql和php就窝火.  

如果选择方法b. 理论步骤上,应该是将当前yum安装mysql产生的所有目录做链接后,统一放置到一个新建的目录下.
再带上选项--with-mysql = "新建的目录" 编译安装 php_mysql.so ;因为本文这里没实践,不保证按此操作的有效性!

所以这里提两句:尽量先装MySQL再装PHP,顺序不要颠倒 !
要编译就全都编译,要yum就全都yum !

【12、】噩梦还在继续, 这下php_mysql倒是能成功Load了.又引出2个问题:

 1、 NDO又出问题, 因为编译ndoutils时有--with-mysql-inc=... 、--with-mysql-lib=...,只好又重新编译ndoutils指定新的mysql-inc 和lib路径.  搞完后, ndo2db守护进程又起不来,提示:Support for the specified database server is either not yet supported, or was not found on your system
原因 : don't have the mysql development libraries installed, or you compiled nagios with an incorrect mysql path.
解决 : yum 装最新的mysql-devel后把include和lib下各自所有的文件分别软链接到之前编译mysql产生的各自同名目录并重装。
yum安装时,根据依赖关系,同时会把mysql、mysql-lib也装上 ;这里注意要尽量装最新的mysql-devel,如果yum源提供的不是最新的就去下mysql、mysql-devel、mysql-lib 3个rpm包手动安装。 这里让人困惑的是,理论上,已经编译好的MySQL library和源代码里的header files 就是 mysql-devel,但不知为什么不行。

如果nagios.log中出现 : 
Error writing to data sink!  Some output may get lost ...
Please check remote ido2db log, database connection or SSL Parameters 

对于这个问题, 网上提到的解决方法有:
『A』删除nagiosuser并停掉所有ndo进程 ,  重装nagios、nagios_plugin、ndoutils. 
『B 』/usr/local/nagios/etc  、/usr/local/nagios/bin 这两个目录或其下文件的权限或属主设置有问题. 
本文按如上所述做相应实施、调整 ,问题依旧!

之后在ndoutils源码db目录下导入数据库结构,生成ndoutils所需要的数据库表 ;install脚本命令必须在db子目录内执行
cd ../db/
./installdb -u cactiuser -p 123456 -h localhost -d cactidb
-u  指定导入时所用的mysql用户帐号
-p  表示前面mysql用户的密码
-h  表示mysql服务器地址,如果是localhost,则可以省略
-d  表示目标数据库
出错:install_driver(mysql) failed: Can't load 'C:/Perl/site/lib/auto/DBD/mysql/mysql.dll' for module DBD::mysql: load_file:The specified module could not be found at C:/Perl/lib/DynaLoader.pm line 230. 
原来是系统缺失perl模块 "DBD::mysql" , 造成ndo连接不上MySQL. 写不进数据, 才有之前的Error writing to data sink! 的错误.   安装"DBD::mysql"过程如下:

# perl -MCPAN -e shell

cpan> install DBD::MySQL

get an error as follows:

cpan> install DBD::MySQL
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
Database was generated on Sun, 11 Apr 2004 02:57:36 GMT
Warning: Cannot install DBD::MySQL, don't know what it is.
Try the command

i /DBD::MySQL/

to find objects with matching identifiers.

do a  " i /DBD::MySQL/ " as suggested above:

Bundle          Bundle::DBD::mysql (C/CA/CAPTTOFU/DBD-mysql-4.020.tar.gz)
Module          Class::DBI::ClassGenerator::DBD::mysql (D/DC/DCANTRELL/Class-DBI-ClassGenerator-1.03.tar.gz)
Module          DBD::mysql      (C/CA/CAPTTOFU/DBD-mysql-4.020.tar.gz)
Module          DBD::mysql::AutoTypes (G/GR/GRISHACE/DBD-mysql-AutoTypes-1.0.tar.gz)
Module          DBD::mysql::GetInfo (C/CA/CAPTTOFU/DBD-mysql-4.020.tar.gz)
Module          DBD::mysql::Install (J/JW/JWIED/Msql-Mysql-modules-1.2219.tar.gz)
Module          DBD::mysql::SimpleMySQL (L/LI/LINNIN/DBD-mysql-SimpleMySQL-0.5.tar.gz)
Module          DBD::mysql::db  (C/CA/CAPTTOFU/DBD-mysql-4.020.tar.gz)
Module          DBD::mysql::dr  (C/CA/CAPTTOFU/DBD-mysql-4.020.tar.gz)
Module          DBD::mysql::st  (C/CA/CAPTTOFU/DBD-mysql-4.020.tar.gz)
Module          DBD::mysqlPP    (T/TS/TSUCCHI/DBD-mysqlPP-0.07.tar.gz)
Module          DBD::mysqlPP::db (T/TS/TSUCCHI/DBD-mysqlPP-0.07.tar.gz)
Module          DBD::mysqlPP::dr (T/TS/TSUCCHI/DBD-mysqlPP-0.07.tar.gz)
Module          DBD::mysqlPP::st (T/TS/TSUCCHI/DBD-mysqlPP-0.07.tar.gz)
Module          DBIx::DBSchema::DBD::mysql (I/IV/IVAN/DBIx-DBSchema-0.40.tar.gz)
Module          DBIx::Skinny::DBD::mysql (N/NE/NEKOKAK/DBIx-Skinny-0.0742.tar.gz)
Module          DBIx::TextIndex::DBD::mysql (D/DK/DKOCH/DBIx-TextIndex-0.28.tar.gz)
Module          Data::Model::Driver::DBI::DBD::mysql (Y/YA/YAPPO/Data-Model-0.00007.tar.gz)
Module          Data::ObjectDriver::Driver::DBD::mysql (S/SI/SIXAPART/Data-ObjectDriver-0.09.tar.gz)
Module          Module::Build::DBD::mysql (D/DW/DWHEELER/Module-Build-DB-0.10.tar.gz)
Module          Qudo::Driver::DBI::DBD::mysql (M/MA/MASARTZ/Qudo-Driver-DBI-0.03.tar.gz)
21 items found

CPAN安装失败, 退出cpan shell.
# cd /root/.cpan/build/DBD-mysql-4.020/
#perl Makefile.PL
#make & make install

再次./installdb -u cactiuser -p 123456 -h localhost -d cactidb 有:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
解决: ln -s /tmp/mysql.sock  /var/lib/mysql/mysql.sock 

所以这里着重提出:不要以为 npc插件会在cacti的数据库中自动生成ndoutils所需要的以“npc_”为前缀的表。
一定要执行installdb手工生成ndoutils所需要的数据库表. 根据出错提示解决连接问题.
否则你会永远被卡在Error writing to data sink! 这个问题上, 让你前功尽弃!!!

2、因为重新编译安装了MySQL,导致spine又连不上. 重新编译安装,之后启动spine又有:
SPINE: Poller[0] FATAL: Connection Failed, Error:'2002', Message:'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)' (Spine init)
修改spine.conf中的DB_Host , 把localhost指定为127.0.0.1解决
 
【13、】最后Cacti web console又不正常,页面有 :  
Access Forbidden!
You don't have permission to access the requested object.  It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403

setatus 或 getenforce 查看Selinux已禁用.  重启apache时有提示:
Warning: DocumentRoot [/usr/local/apache/docs/dummy-host.example.com] does not exist
Warning: DocumentRoot [/usr/local/apache/docs/dummy-host2.example.com] does not exist
原因 : cd /usr/local/apache/
发现没有docs目录,只有htdocs;但在logs/中有dummy-host.example.com-access_log和dummy-host2.example.com-error_log,在后一个error_log中有记录:
client denied by server configuration: /usr/local/apache/docs
client denied by server configuration: /var/www/html/cacti/index.php
读不到cacti的index页面,故出现这个错误。

后来发现/usr/local/apache/conf/extra/httpd-vhosts.conf, 控制着DocumentRoot和log日志的定向,将DocumentRoot改为cacti的主目录,其余值根据自身情况指定即可. 所谓http-vhosts.conf,可将其理解成针对virtulhosts虚拟机的apache辅助配置文件. 

【14】Nagios主页,Current Status —> Map 
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Error 404
同时, apache 的error_log有 :
script not found or unable to stat: /usr/local/nagios/sbin/statusmap.cgi, referer:http://your_nagios_server_ip/nagios/side.php

解决
对于该链接中提到的包可以yum也可以去下载.  
提醒: 操作前一定要注意备份nagios的所有配置文件.

【15】there are many repeated php error notifications in apache error log , you can see it in nagios web interface too. 
It's a notice level error notification.

APPEARANCE: " PHP Notice:  Undefined index: link in /usr/local/nagios/share/main.php on line 94 "
SOLUTION :  Just comment out the line with error_reporting in the php.ini file or set it to error_reporting = E_ALL & ~E_NOTICE that is the default behaviour.

【16】如果Cacti的npc页面Nagios Status为Off  . 
确认两点: 1、ndo daemon进程存在  2、在nagios.cfg中有添加ndo的broker_module,并为Nagios开启event broker

【17】对于Nagios + Cacti 的整个安装配置过程,还可以参考 :  http://zhumeng8337797.blog.163.com/blog/static/100768914201182785336268/ 这个链接记录得很详细. 

其它一些有用的链接:
http://sery.blog.51cto.com/10037/20520
http://lihuipeng007.blog.163.com/blog/static/1210843882011415447882/
阅读(10018) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~