[SOLVED] NDOUtils Nagios and MySQL Server on different hosts

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
User avatar
sebastiaopburnay
Posts: 105
Joined: Sun Oct 31, 2010 1:40 pm
Location: Lisbon, Portugal

[SOLVED] NDOUtils Nagios and MySQL Server on different hosts

Post 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
Attachments
Logic
Logic
Last edited by sebastiaopburnay on Sun Mar 09, 2014 10:54 am, edited 2 times in total.
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post 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.
User avatar
sebastiaopburnay
Posts: 105
Joined: Sun Oct 31, 2010 1:40 pm
Location: Lisbon, Portugal

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
sebastiaopburnay
Posts: 105
Joined: Sun Oct 31, 2010 1:40 pm
Location: Lisbon, Portugal

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
sebastiaopburnay
Posts: 105
Joined: Sun Oct 31, 2010 1:40 pm
Location: Lisbon, Portugal

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
sebastiaopburnay
Posts: 105
Joined: Sun Oct 31, 2010 1:40 pm
Location: Lisbon, Portugal

Re: NDOUtils - Nagios and MySQL Server on different hosts

Post by sebastiaopburnay »

Ok, there you go
Attachments
nagios.cfg
(43.75 KiB) Downloaded 771 times
Locked