1.首先请检查ndo2db的进程是不是二个
nagios 16825 0.0 0.1 6784 396 ? Ss 19:05 0:00 /usr/local/nagios/bin/ndo2db -c /usr/l nagios 17032 0.0 0.3 6784 1268 ? S 19:09 0:00 /usr/local/nagios/bin/ndo2db -c 2、检查nagios.log日志看看最后有没有 could not safely copy module '/usr/local/nagios/bin/ndomod-3x.o' 这样的错误 如果是下面这样是正确的 ndomod: NDOMOD 1.4b7 (10-31-2007) Copyright (c) 2005-2007 Ethan Galstad () [1272020945] ndomod: Successfully connected to data sink. 4897 queued items to flush. [1272020951] ndomod: Successfully flushed 4897 queued items to data sink. [1272020951] Event broker module '/usr/local/nagios/bin/ndomod-3x.o' initialized successfully. 上面只是检查工作,解决方法如下 1、安装nagios3.0 如果是2.9的朋友可以升级安装、升级安装方法的方法很简单
#cd /usr/local/
#cp -r nagios/ nagios2.9 #cd /etc/init.d/ #cd nagios nagios2.9 #cp nagios nagios2.9 #tar -zvxf nagios-3.0.3.tar.gz #cd nagios-3.0.3 # ./configure --with-command-group=nagios #make all #make install #/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 可能会报comments downtime警告信息一个错误critical vi /usr/local/nagios/etc/nagios.cfg #comment_file=/usr/local/nagios/var/comments.dat 加上# #downtime_file=/usr/local/nagios/var/downtime.dat 加上#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 在执行就不会报了
然后在执行下面 cd /usr/local/nagios/var/ cat comments.dat >>retention.dat cat downtime.dat >>retention.dat critical错误解决 check_result_buffer_slots=4096 加上# service nagios restart 2、ndoutils-1.4b7安装此版块、其他版本可能会出程序问题、安装方法如下 tar zxvf ndoutils-1.4b7.tar.gz cd ndoutils-1.4b7 ./configure --with-mysql-lib=/usr/lib/mysql/ --with-mysql-inc=/usr/include/mysql/ cp ndomod-3x.o /usr/local/nagios/bin/ndomod-3x.o cp ndo2db-3x /usr/local/nagios/bin/ndo2db cp ndo2db.cfg /usr/local/nagios/etc/ cp ndomod.cfg /usr/local/nagios/etc/ 进入拷贝的目录给文件加入到nagios用户组 chown nagios:nagios ndo2db.cfg ndomod.cfg chown nagios:nagios ndomod-3x.o ndo2db然后修改ndo2db.cfg ndomod.cfg配置文件
cat /usr/local/nagios/etc/ndo2db.cfg |grep -v '^#'|sed /^$/d ndo2db_user=nagios ndo2db_group=nagios socket_type=tcp socket_name=/usr/local/nagios/var/ndo.sock tcp_port=5668 db_servertype=mysql db_host=127.0.0.1 db_port=3306 db_name=cacti db_prefix=npc_ db_user=cactiuer db_pass=cactiuser max_timedevents_age=1440 max_systemcommands_age=10080 max_servicechecks_age=10080 max_hostchecks_age=10080 max_eventhandlers_age=44640 debug_level=1 debug_verbosity=1 debug_file=/usr/local/nagios/var/ndo2db.debug max_debug_file_size=1000000cat /usr/local/nagios/etc/ndomod.cfg |grep -v '^#'|sed /^$/d
instance_name=default output_type=tcpsocket output=127.0.0.1 tcp_port=5668 output_buffer_items=5000 buffer_file=/usr/local/nagios/var/ndomod.tmp file_rotation_interval=14400 file_rotation_timeout=60 reconnect_interval=15 reconnect_warning_interval=15 data_processing_options=-1 config_output_options=2最后看nagios.cfg最后一行配置文件是否正确 broker_module=/usr/local/nagios/bin/ndomod-3x.o config_file=/usr/local/nagios/etc/ndomod.cfg 这行要和文件和路径对应好(===我属于这种情况===)
修改完成后重启ndo2db kill ndo2db运行的进程 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg 然后执行重启 ps aux nagios 16825 0.0 0.1 6784 396 ? Ss 19:05 0:00 /usr/local/nagios/bin/ndo2db -c nagios 17032 0.0 0.3 6784 1268 ? S 19:09 0:00 /usr/local/nagios/bin/ndo2db -c
参考:http://blog.sina.com.cn/s/blog_645e2f0b010135tf.html