歡迎您光臨本站 註冊首頁

cacti整合nagios導入nagios數據問題

←手機掃碼閱讀     火星人 @ 2014-03-03 , reply:0

cacti整合nagios導入nagios數據問題


守護進程能起來
service ndo2db restart
Stopping ndo2db: done.
Starting ndo2db: done.
錯誤日誌
ndomod: Successfully reconnected to data sink!  0 items lost, 100 queued items to flush.
ndomod: Successfully flushed 100 queued items to data sink.
ndomod: Error writing to data sink!  Some output may get lost...
ndomod: Please check remote ndo2db log, database connection or SSL Parameters
ndomod: Successfully reconnected to data sink!  0 items lost, 159 queued items to flush.
ndomod: Successfully flushed 159 queued items to data sink.
ndomod: Error writing to data sink!  Some output may get lost...
ndomod: Please check remote ndo2db log, database connection or SSL Parameters
《解決方案》

http://www.leadkj.com/archives-366.html
《解決方案》

為什麼nagios整合cacti后NPC里的nagios總是OFF!

解決辦法是修改一下文件的內容,不過最主要的是這幾個:
output_type=tcpsocket
output=127.0.0.1
socket_type=tcp

改完之後重啟服務試試,我第一次測試安裝是一次成功,但是整合公司原來配置好的服務時候,出現了nagios  OFF現象。。  (看看nagios裡面的的配置文件許可權是不是nagios,我認為有這個方面的原因,配置文件都是root  mv過來的)
《解決方案》

service ndo2db restart
Starting ndo2db:Support for the specified database server is either not yet supported, or was not found on your system.

這個是由於沒有安裝mysql-devel這個包造成的@!@@@@
解決辦法:
yum -y install mysql-devel
重新編譯ndo2db
./configure --prefix=/usr/local/nagios LDFLAGS=-L/usr/lib64 --with-mysql-inc=/usr/include/mysql --with-mysql-lib=/usr/lib64/mysql --enable-

mysql --disable-pgsql --with-ndo2db-user=nagios --with-ndo2db-group=nagios
cp src/{ndomod-3x.o,ndo2db-3x,file2sock,log2ndo} /usr/local/nagios/bin

uname -a
Linux Nagios.com 2.6.18-238.el5 #1 SMP Thu Jan 13 16:24:47 EST 2011 i686 i686 i386 GNU/Linux

cd ndoutils
./configure --prefix=/usr/local/nagios --enable-mysql --disable-pgsql LDFLAGS=-L/usr/local/mysql/lib --with-mysql-

inc=/usr/local/mysql/include --with-mysql-lib=/usr/local/mysql/lib --with-ndo2db-user=nagios --with-ndo2db-group=nagios


/usr/local/nagios/bin/ndo2db  -c /usr/local/nagios/etc/ndo2db.cfg
/usr/local/nagios/bin/ndo2db: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or

directory
解決方法
ln -s /usr/local/mysql/lib/* /usr/lib/
ldconfig -v
/usr/local/nagios/bin/ndo2db  -c /usr/local/nagios/etc/ndo2db.cfg  可以啟動守護進程

Still unable to connect to data sink.  14611 items lost, 5000 queued items to flush


egrep  -v "^#|^$"  /usr/local/nagios/etc/ndo2db.cfg
ndo2db_user=nagios
ndo2db_group=nagios
socket_type=tcp
socket_name=/usr/local/nagios/var/ndo.sock
tcp_port=5668
use_ssl=0
db_servertype=mysql
db_host=localhost
db_port=3306
db_name=nagios
db_prefix=npc_
db_user=cacti
db_pass=zly1994
max_timedevents_age=1440
max_systemcommands_age=10080
max_servicechecks_age=10080
max_hostchecks_age=10080
max_eventhandlers_age=44640
max_externalcommands_age=44640
debug_level=1
debug_verbosity=1
debug_file=/usr/local/nagios/var/ndo2db.debug
max_debug_file_size=1000000

instance_name=default
output_type=tcpsocket
output=127.0.0.1
tcp_port=5668
use_ssl=0
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

DBI connect('database=ndodb;host=localhost','ndoutils',...) failed: Can't connect to local MySQL server through socket

'/var/lib/mysql/mysql.sock' (2) at ./installdb line 41

mkdir -p /var/lib/mysql
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

./installdb -u cacti -pzly1994  -h localhost -d cactidb
DBD::mysql::db do failed: Table 'cactidb.nagios_dbversion' doesn't exist at ./installdb line 51.
** Creating tables for version 1.4b9
     Using mysql.sql for installation...
** Updating table nagios_dbversion
Done!

install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi

/usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi

/usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at (eval

5) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Proxy, Sponge.
at ./installdb line 41

執行 yum install  perl-DBD-MySQL

Caught SIGTERM, shutting down...
Successfully shutdown... (PID=10852)
ndomod: Shutdown complete.
Event broker module '/usr/local/nagios/bin/ndomod-3x.o' deinitialized successfully.
Nagios 3.2.3 starting... (PID=10932)
Local time is Mon Jan 07 15:50:29 CST 2013
LOG VERSION: 2.0
ndomod: NDOMOD 1.4b9 (10-27-2009) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
ndomod: Successfully connected to data sink.  320 queued items to flush.
ndomod: Error writing to data sink!  Some output may get lost.  128 queued items to flush.
Event broker module '/usr/local/nagios/bin/ndomod-3x.o' initialized successfully.
Finished daemonizing... (New PID=10935)



an  8 09:23:41 Nagios ndo2db: mysql_error: 'Unknown column 'long_output' in 'field list''
Jan  8 09:23:41 Nagios ndo2db: Error: mysql_query() failed for 'INSERT INTO npc_systemcommands SET instance_id='1', start_time=FROM_UNIXTIME

(1357608221), start_time_usec='109858', end_time=FROM_UNIXTIME(1357608221), end_time_usec='175872',

command_line='/usr/local/nagios/libexec/process_perfdata\.pl', timeout='5', early_timeout='0', execution_time='0.066000', return_code='0',

output='', long_output='' ON DUPLICATE KEY UPDATE instance_id='1', start_time=FROM_UNIXTIME(1357608221), start_time_usec='109858',

end_time=FROM_UNIXTIME(1357608221), end_time_usec='175872', command_line='/usr/local/nagios/libexec/process_perfdata\.pl', timeout='5',

early_timeout='0', execution_time='0.066000', return_code='0', output='', long_output='''
Jan  8 09:23:41 Nagios ndo2db: mysql_error: 'Unknown column 'long_output' in 'field list''

2、cacti插件npc提示no hosts
tail -100 /var/log/messages
localhost ndo2db-3x: mysql_error: 'Unknown column 'long_output' in 'fieldlist''
添加缺失的對應欄位
ALTER TABLE npc_eventhandlers ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;
ALTER TABLE npc_hostchecks ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;
ALTER TABLE npc_hoststatus ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;
ALTER TABLE npc_notifications ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;
ALTER TABLE npc_servicechecks ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;
ALTER TABLE npc_servicestatus ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;
ALTER TABLE npc_statehistory ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;
ALTER TABLE npc_systemcommands ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;


Nagios 3.2.3 starting... (PID=2238)
Local time is Tue Jan 08 09:25:43 CST 2013
LOG VERSION: 2.0
ndomod: NDOMOD 1.4b9 (10-27-2009) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
ndomod: Successfully connected to data sink.  0 queued items to flush.
Event broker module '/usr/local/nagios/bin/ndomod-3x.o' initialized successfully.
Finished daemonizing... (New PID=2242)

Still unable to connect to data sink.  14611 items lost, 5000 queued items to flush
解決方法
配置ndo2db.cfg
socket_type=tcp
配置ndomon.cfg
output_type=tcpsocket
output=127.0.0.1

mysql錯誤 不管怎樣修改 它始終去找/tmp/mysql.sock
做軟連接 或者修改
mysql sock鎖文件更改為/tmp/mysql.sock

修改數據表 增加缺少的欄位
ALTER TABLE npc_eventhandlers ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;
ALTER TABLE npc_hostchecks ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;
ALTER TABLE npc_hoststatus ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;
ALTER TABLE npc_notifications ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;
ALTER TABLE npc_servicechecks ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;
ALTER TABLE npc_servicestatus ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;
ALTER TABLE npc_statehistory ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;
ALTER TABLE npc_systemcommands ADD long_output TEXT NOT NULL DEFAULT '' AFTERoutput;
《解決方案》

http://os.51cto.com/exp/yjs/index.html
《解決方案》

http://www.linuxmr.com/index.php?m=content&c=tag&catid=32&tag=zabbix&page=0
《解決方案》

http://lsscto.blog.51cto.com/779396/904996
《解決方案》

可能是許可權的問題

[火星人 ] cacti整合nagios導入nagios數據問題已經有1962次圍觀

http://coctec.com/docs/service/show-post-411.html