萨尔法保护 发表于 2019-1-10 13:09:03

cacti+nagios 整合遇到的问题

  cacti安装成功了,下载一个npc插件来套用nagios,nagios要用ndoutils和cacti连接。
  

  主要安装ndoutils出现的问题。
  启动ndoutils时出错:
  /usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg
  错误提示:
  Support for the specified database server is either not yet supported, or was not found on your system
  原因:mysql的库文件没有被加载,编译是时注意:
  checking for linker flags for loadable modules... -shared
checking for mysql_config... /usr/bin/mysql_config
checking for mysql_init in -lmysqlclient... yes
MySQL library and include file(s) were found!
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating docs/docbook/en-en/Makefile
config.status: creating subst
config.status: creating include/config.h
config.status: include/config.h is unchanged

  以上蓝色部分是否都有。
  

  解决方法:
  yum安装的mysql
  ./configure --enable-mysql
  编译安装的mysql
  ./configure --enable-mysql --with-mysql=/usr/local/mysql ### mysql 路径
  把库文件做软连接
  ln -s /usr/local/mysql/lib/* /usr/lib/
  ln -s /usr/local/mysql/include/* /usr/include/
  echo "/usr/lib" > /etc/ld.so.config
  ldconfig -v
  编译安装不是亲测的。
  

  就可以启动了,
  启动后还是不现实
  查看日志:
  tail -30 /var/log/message
  错误:
  nagios ndo2db-3x: Error: mysql_query() failed for 'INSERT INTO nagios_configfilevariablesSET instance_id='1', configfile_id='3', varname='cfg_file', varvalue='/usr/local/nagios//etc/objects/localhost\.cfg
  解决方法:
  登录mysql
  输入以下信息:

  alter table nagios.nagios_configfilevariablesdrop key instance_id;alter table nagios.nagios_configfilevariables add index (instance_id, configfile_id, varname);
  重启naigos后还是不显示,
  在看日志又出现:
  localhost ndo2db-3x: mysql_error: 'Unknown column 'long_output' in 'fieldlist''
解决方法:
  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 '' AFTERo utput;
ALTER TABLE npc_systemcommands ADD long_output TEXT NOT NULL DEFAULT '' AFTER output;
  把以上内容写入naigos.sql
  运行:
  mysql -u root -p nagios < naigos.sql
  输入密码:
  再重启naigos。
  终于出现了内容:
http://blog.运维网.com/attachment/201305/155254348.jpg
  

  以上是个人整理。详细内容请看:
  http://ppp1013.blog.运维网.com/927700/214781

  http://blog.csdn.net/xiangliangyu2008/article/details/7758750

  

  



附件:http://down.运维网.com/data/2362836

页: [1]
查看完整版本: cacti+nagios 整合遇到的问题