[SOLVED] problem ndoutils-2.0.0 on nagios-4.1.1

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

[SOLVED] problem ndoutils-2.0.0 on nagios-4.1.1

Post by sebastiaopburnay »

Hi!

I have always used nagios-3.5.1 with ndoutils1.49B ...

Now I tried
i) a fresh 64bits Ubuntu Server 14.04 LTS
ii) nagios-4.1.1
iii) ndoutils-2.0.0.

As far as nagios-4x, it seems it has different logic of worker threads supporting a patrent nagios process/daemon - everything seems legit here and it is working fine.

My problem is with NDOUtils-2.0.0. What have _I done so far:
1 I've compiled/installed NDOUtils from the ndoutils-2.0.0.tar.gz
2 I've created a mysql db named nagios
3 I've created a user named nagios (with passed nagios)and all privileges @localhost to the nagios' database
4 I've run the installdb script and verified the correct schema was created
5 I've copyed the 4x binaries to /usr/local/nagios/bin
6 I've configured the ndomod.cfg, ndo2db,cfg and added broker_module options on the nagios.cfg

When I try to run 'service ndo2db start' I get a 'ndo2db: unrecognized service' error
When I try to launch trough '/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg' I get a different error:

Code: Select all

Support for the specified database server is either not yet supported, or was not found on your system.
I've checked different posts where the problem was similar, but I've found no appropriate answers

Whatever feedback/config files or other information you need, I'll provide

Thank you in advance for your time and experteese
Last edited by sebastiaopburnay on Tue Jul 05, 2016 12:08 pm, edited 1 time in total.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: problem ndoutils-2.0.0 on nagios-4.1.1

Post by tgriep »

Can you post your /usr/local/nagios/etc/ndo2db.cfg file and the /etc/init.d/ndo2db init script so we can view them?
Are you getting and error messages in the mysql log file, if so can you post them?

Also, login as root to the Nagios server, run the following and post the output.

Code: Select all

ps -ef --cols=300
ls -l /usr/local/nagios/etc/
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
sebastiaopburnay
Posts: 105
Joined: Sun Oct 31, 2010 1:40 pm
Location: Lisbon, Portugal

Re: problem ndoutils-2.0.0 on nagios-4.1.1

Post by sebastiaopburnay »

I've found the problem was related to the compiling of ndoutils (I was misspelling the MySQL lib dir). Once I've corrected it I could then start the ndo2db.

The thing is I've run into a new problem, entries on nagios' log file 'ndomod: Could not open data sink!'

Code: Select all

[1467733831] Nagios 4.1.1 starting... (PID=29059)
[1467733831] Local time is Tue Jul 05 08:50:31 PDT 2016
[1467733831] LOG VERSION: 2.0
[1467733831] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1467733831] qh: core query handler registered
[1467733831] nerd: Channel hostchecks registered successfully
[1467733831] nerd: Channel servicechecks registered successfully
[1467733831] nerd: Channel opathchecks registered successfully
[1467733831] nerd: Fully initialized and ready to rock!
[1467733831] wproc: Successfully registered manager as @wproc with query handler
[1467733831] wproc: Registry request: name=Core Worker 29062;pid=29062
[1467733831] wproc: Registry request: name=Core Worker 29061;pid=29061
[1467733831] wproc: Registry request: name=Core Worker 29064;pid=29064
[1467733831] wproc: Registry request: name=Core Worker 29063;pid=29063
[1467733831] ndomod: NDOMOD 2.0.0 (02-28-2014) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
[1467733831] ndomod: Could not open data sink!  I'll keep trying, but some output may get lost...
[1467733831] ndomod registered for contact data'
[1467733831] ndomod registered for contact notification data'
[1467733831] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.
[1467733831] Successfully launched command file worker with pid 29065
As for ndo2db.cfg:

Code: Select all

root@ubuntu:~# grep -v '^#' /usr/local/nagios/etc/ndo2db.cfg | grep -v '^$'
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=localhost
db_port=3306
db_name=nagios
db_prefix=nagios_
db_user=nagios
db_pass=nagios
max_timedevents_age=1440
max_systemcommands_age=10080
max_servicechecks_age=10080
max_hostchecks_age=10080
max_eventhandlers_age=44640
max_externalcommands_age=44640
max_notifications_age=44640
max_contactnotifications=44640
max_contactnotificationmethods=44640
max_logentries_age=129600
max_acknowledgements_age=44640
debug_level=1
debug_verbosity=1
debug_file=/usr/local/nagios/var/ndo2db.debug
max_debug_file_size=1000000
Nagios' config dir:

Code: Select all

root@ubuntu:~# ls -l /usr/local/nagios/etc/
total 84
-rw-rw-r-- 1 nagios nagios 12267 Jul  5 04:39 cgi.cfg
-rw-r--r-- 1 root   root      50 Jul  5 04:42 htpasswd.users
-rw-rw-r-- 1 nagios nagios 44920 Jul  5 05:10 nagios.cfg
-rw------- 1 root   root    4887 Jul  5 08:49 ndo2db.cfg
-rw------- 1 root   root    5133 Jul  5 08:49 ndomod.cfg
drwxrwxr-x 2 nagios nagios  4096 Jul  5 04:39 objects
-rw-rw---- 1 nagios nagios  1312 Jul  5 04:39 resource.cfg
- /var/log/mysql.err is empty
- /var/log/mysql/error.log goes as:

Code: Select all

Version: '5.5.49-0ubuntu0.14.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
160705  8:17:35 [Warning] 'user' entry 'root@ubuntu' ignored in --skip-name-resolve mode.
160705  8:17:35 [Warning] 'proxies_priv' entry '@ root@ubuntu' ignored in --skip-name-resolve mode.
160705  8:19:11 [Warning] 'user' entry 'root@ubuntu' ignored in --skip-name-resolve mode.
160705  8:19:11 [Warning] 'proxies_priv' entry '@ root@ubuntu' ignored in --skip-name-resolve mode.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: problem ndoutils-2.0.0 on nagios-4.1.1

Post by tgriep »

The data sink message is normal when the ndomod broker is first initialized.

Later in the log file, you should see messages similar to this showing that they are getting written out.

Code: Select all

ndomod: Successfully connected to data sink.  669 queued items to flush.
ndomod: Successfully flushed 669 queued items to data sink.
Also, you could check the mysql tables to see if the data is getting written to it.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
sebastiaopburnay
Posts: 105
Joined: Sun Oct 31, 2010 1:40 pm
Location: Lisbon, Portugal

Re: problem ndoutils-2.0.0 on nagios-4.1.1

Post by sebastiaopburnay »

tgriep wrote:The data sink message is normal when the ndomod broker is first initialized.

Later in the log file, you should see messages similar to this showing that they are getting written out.

Code: Select all

ndomod: Successfully connected to data sink.  669 queued items to flush.
ndomod: Successfully flushed 669 queued items to data sink.
Also, you could check the mysql tables to see if the data is getting written to it.
Well, those messages never show on the log and the nagios' database's tables keep empty:

Code: Select all

mysql> use nagios;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> SELECT * FROM nagios_objects;
Empty set (0.00 sec)
As you can see, the running processes seem fine:

Code: Select all

root@ubuntu:~# ps -ef | grep nagios
root     28247 28218  0 16:15 pts/1    00:00:00 tail -f /usr/local/nagios/var/nagios.log
root     28751 28736  0 16:23 pts/3    00:00:00 tail -f /usr/local/nagios/var/ndo2db.debug
nagios   29886     1  0 17:11 ?        00:00:00 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
nagios   29937     1  0 17:11 ?        00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios   29939 29937  0 17:11 ?        00:00:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios   29940 29937  0 17:11 ?        00:00:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios   29941 29937  0 17:11 ?        00:00:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios   29942 29937  0 17:11 ?        00:00:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios   29943 29937  0 17:11 ?        00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
root     30068  1573  0 17:38 pts/2    00:00:00 grep --color=auto nagios
But the log output never seems to evolve, nor the database's tables get populated
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: problem ndoutils-2.0.0 on nagios-4.1.1

Post by tgriep »

Can you post your /usr/local/nagios/etc/ndomod.cfg file?
The data_processing_options option in that file controls what is written to the MYSQL database.
If you set it to "-1", it will write everything to the MYSQL database.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
sebastiaopburnay
Posts: 105
Joined: Sun Oct 31, 2010 1:40 pm
Location: Lisbon, Portugal

[SOLVED] problem ndoutils-2.0.0 on nagios-4.1.1

Post by sebastiaopburnay »

Well....

The machine is allays right

Turns out it had to do with the previous ownership of ndo2db.cfg and ndomod.cfg (which was erroneously root)

Code: Select all

root@ubuntu:~# ll /usr/local/nagios/etc/
total 92
drwxrwxr-x 3 nagios nagios  4096 Jul  5 13:12 ./
drwxr-xr-x 9 root   root    4096 Jul  5 12:50 ../
-rw-rw-r-- 1 nagios nagios 12267 Jul  5 12:39 cgi.cfg
-rw-r--r-- 1 root   root      50 Jul  5 12:42 htpasswd.users
-rw-rw-r-- 1 nagios nagios 44920 Jul  5 13:10 nagios.cfg
-rw------- 1 root   root    4888 Jul  5 17:52 ndo2db.cfg
-rw------- 1 root   root    5133 Jul  5 16:49 ndomod.cfg
drwxrwxr-x 2 nagios nagios  4096 Jul  5 12:39 objects/
-rw-rw---- 1 nagios nagios  1312 Jul  5 12:39 resource.cfg
After running 'chown -R nagios:nagios /usr/local/nagios/etc/', everything went as expected.

Thanks to this other post: https://support.nagios.com/forum/viewto ... =7&t=25366.

Thank you for your time and synapses :)
Locked