Page 1 of 4

[SOLVED] NDOUtils Nagios and MySQL Server on different hosts

Posted: Fri Nov 29, 2013 1:00 pm
by sebastiaopburnay
Hi!

I've been using Nagios and NDOUtils for quite some time.

Recently we've decided to use the latest Ubuntu Server LTS (12.0.4 64bits) and to separate the Nagios core server from the NDOUtils Database server.

Both Servers are Ubuntu 12.0.4 Server 64bit.

We are using Nagios 3.5.0 and NDOUtils 1.4b9.

I can use the configured account to access the database from the Nagios' server CLI.

When I restart nagios (having ndo2db already started) and I do a 'tail -f /usr/local/nagios/var/nagios.log' I get:

Code: Select all

[1385747245] Nagios 3.5.0 starting... (PID=28945)
[1385747245] Local time is Fri Nov 29 17:47:25 UTC 2013
[1385747245] LOG VERSION: 2.0
[1385747245] ndomod: NDOMOD 1.4b9 (10-27-2009) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
[1385747245] ndomod: Successfully connected to data sink.  61 queued items to flush.
[1385747245] ndomod: Successfully flushed 61 queued items to data sink.
[1385747245] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.
[1385747245] Finished daemonizing... (New PID=28947)
[1385747246] ndomod: Error writing to data sink!  Some output may get lost...
[1385747246] ndomod: Please check remote ndo2db log, database connection or SSL Parameters
[1385747262] ndomod: Successfully reconnected to data sink!  0 items lost, 96 queued items to flush.
[1385747262] ndomod: Successfully flushed 96 queued items to data sink.
[1385747262] ndomod: Error writing to data sink!  Some output may get lost...
[1385747262] ndomod: Please check remote ndo2db log, database connection or SSL Parameters
[1385747278] ndomod: Successfully reconnected to data sink!  0 items lost, 88 queued items to flush.
[1385747278] ndomod: Successfully flushed 88 queued items to data sink.
[1385747278] ndomod: Error writing to data sink!  Some output may get lost...
[1385747278] ndomod: Please check remote ndo2db log, database connection or SSL Parameters
...
...
...
In nagios.cfg I have

Code: Select all

event_broker_options=-1
broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg
I beleive it has something to do either with my ndomod.cfg or with my ndo2db.cfg and also with the fact that the database is not local

My ndo2db.cfg:

Code: Select all

lock_file=/usr/local/nagios/var/ndo2db.lock
ndo2db_user=nagios
ndo2db_group=nagios
socket_type=unix
socket_name=/usr/local/nagios/var/ndo.sock
tcp_port=5668
use_ssl=0
db_servertype=mysql
db_host=x.y.z.135
db_port=3306
db_name=ndoutils
db_prefix=nagios_
db_user=xxxx
db_pass=yyyy
max_timedevents_age=1440
max_systemcommands_age=10080
max_servicechecks_age=57600
max_hostchecks_age=57600
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
My ndomod.cfg file

Code: Select all

instance_name=myInstance
output_type=unixsocket
output=/usr/local/nagios/var/ndo.sock
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
Best regards,
Sebastião

Re: NDOUtils - Nagios and MySQL Server on different hosts

Posted: Sun Dec 01, 2013 6:01 pm
by jsmurphy
More likely than not it's probably an authentication problem, increase the debug level in the NDOUtils config to get more details on why it can't connect.

Re: NDOUtils - Nagios and MySQL Server on different hosts

Posted: Mon Dec 02, 2013 9:53 am
by sebastiaopburnay
Well, I doubt it is an authentication issue because the credetials used for MySQL work with the CLI both locally and remotely.

The «funny» thing is that I've enabled all verbosity options on ndo2db.cfg and the ndo2db.debug remains empty:

Code: Select all

root@SRVCARTMSCORE01:/usr/local/nagios/var# ll | grep ndo
srwxr-xr-x 1 nagios nagios       0 Dec  2 10:47 ndo.sock=
-rw-r--r-- 1 nagios nagios       0 Nov 29 17:07 ndo2db.debug
-rw-r--r-- 1 nagios nagios       5 Dec  2 10:47 ndo2db.lock

Re: NDOUtils - Nagios and MySQL Server on different hosts

Posted: Mon Dec 02, 2013 2:14 pm
by scottwilkerson
your ndo.sock is not named correctly, and is

Code: Select all

 ndo.sock=
I would check to make sure you do not have incorrect line-endings in ndo2db.cfg or something else extraneous for socket_name in that file

Re: NDOUtils - Nagios and MySQL Server on different hosts

Posted: Mon Dec 02, 2013 2:18 pm
by abrist
Just to verify, have you configured the ndo2db.cfg file with:

Code: Select all

debug_level=-1
debug_verbosity=2
And then restarted ndo?

Code: Select all

service ndo2db restart
To build off of what Scott referenced above - you may want to install dos2unix and then make sure that the ndo configuration files have unix line endings:

Code: Select all

yum install dos2unix -y

Code: Select all

dos2unix /usr/local/nagios/etc/ndo2db.cfg
dos2unix /usr/local/nagios/etc/ndomod.cfg
One last note: If you use filezilla/winscp to access files, make sure that the editor you choose in windows does not change line endings on save.

Re: NDOUtils - Nagios and MySQL Server on different hosts

Posted: Tue Dec 03, 2013 12:00 pm
by sebastiaopburnay
scottwilkerson wrote:your ndo.sock is not named correctly, and is

Code: Select all

 ndo.sock=
I would check to make sure you do not have incorrect line-endings in ndo2db.cfg or something else extraneous for socket_name in that file
You might be right scottwilkerson, I have previously edited that file with Notepad++ on a Windows7 PC, yet I don't seem to find any trange characters in the file when I edit it with nano.
abrist wrote:Just to verify, have you configured the ndo2db.cfg file with:

Code: Select all

debug_level=-1
debug_verbosity=2
And then restarted ndo?

Code: Select all

service ndo2db restart
I've done that and still no data was writen to ndo2db.debug
abrist wrote: To build off of what Scott referenced above - you may want to install dos2unix and then make sure that the ndo configuration files have unix line endings:

Code: Select all

yum install dos2unix -y

Code: Select all

dos2unix /usr/local/nagios/etc/ndo2db.cfg
dos2unix /usr/local/nagios/etc/ndomod.cfg
One last note: If you use filezilla/winscp to access files, make sure that the editor you choose in windows does not change line endings on save.
Well, I've installed with 'apt-get install dos2unix' (64bit Ubuntu 12.04 LTS distro) and ran the mentioned commands upon the '.cfg. files, restarted ndo2db and nagios.

Yet, I still have the strange 'ndo.sock=' file instead of 'ndo.sock', the ndo2db.debug log file is still empty and the nagios.log presents the same errors... needless to say, the data is not being writen in my MySQL Database.

Re: NDOUtils - Nagios and MySQL Server on different hosts

Posted: Tue Dec 03, 2013 12:13 pm
by abrist
Did you restart nagios and ndo after the changes to the config above? If not, please do so:

Code: Select all

service nagios restart
service ndo2db restart

Re: NDOUtils - Nagios and MySQL Server on different hosts

Posted: Tue Dec 03, 2013 12:20 pm
by sebastiaopburnay
abrist wrote:Did you restart nagios and ndo after the changes to the config above? If not, please do so:

Code: Select all

service nagios restart
service ndo2db restart
Yes,

To make sure, I even rebooted the machine and still no changes

Re: NDOUtils - Nagios and MySQL Server on different hosts

Posted: Tue Dec 03, 2013 12:37 pm
by abrist
Could you attach a copy of your nagios.cfg (do not paste the text, just attach the file to your next post)? We want to check it out in a hex editor for any hidden strings.

Re: NDOUtils - Nagios and MySQL Server on different hosts

Posted: Tue Dec 03, 2013 12:41 pm
by sebastiaopburnay
Ok, there you go