Page 2 of 4

Re: ndo2db don't write anything to datadase

Posted: Tue Apr 14, 2015 1:04 am
by adengin

Code: Select all

root@nagios:~# ls -l /usr/local/nagios/bin/ndo*
-rwxr-xr-x 1 nagios nagios 276780 Mar 31 17:45 /usr/local/nagios/bin/ndo2db
-rwxr-xr-x 1 nagios nagios 180239 Mar 30 18:16 /usr/local/nagios/bin/ndomod-4x.o
-rwxr-xr-x 1 nagios nagios 180239 Mar 31 17:45 /usr/local/nagios/bin/ndomod.o

Code: Select all

root@nagios:~# ls -l /usr/local/nagios/etc/nd*
-rwxrwxrwx 1 nagios nagios 4829 Apr  1 09:31 /usr/local/nagios/etc/ndo2db.cfg
-rwxrwxrwx 1 nagios nagios 5133 Apr  6 15:14 /usr/local/nagios/etc/ndomod.cfg

Code: Select all

[1428991167] Nagios 4.0.8 starting... (PID=15358)
[1428991167] Local time is Tue Apr 14 08:59:27 MSK 2015
[1428991167] LOG VERSION: 2.0
[1428991167] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initia
lized
[1428991167] qh: core query handler registered
[1428991167] nerd: Channel hostchecks registered successfully
[1428991167] nerd: Channel servicechecks registered successfully
[1428991167] nerd: Channel opathchecks registered successfully
[1428991167] nerd: Fully initialized and ready to rock!
[1428991167] wproc: Successfully registered manager as @wproc with query handler
[1428991167] wproc: Registry request: name=Core Worker 15364;pid=15364
[1428991167] wproc: Registry request: name=Core Worker 15365;pid=15365
[1428991167] wproc: Registry request: name=Core Worker 15361;pid=15361
[1428991167] wproc: Registry request: name=Core Worker 15363;pid=15363
[1428991167] wproc: Registry request: name=Core Worker 15360;pid=15360
[1428991167] wproc: Registry request: name=Core Worker 15362;pid=15362
[1428991167] ndomod: NDOMOD 2.0.0 (02-28-2014) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
[1428991167] ndomod: Successfully connected to data sink.  0 queued items to flush.
[1428991167] ndomod registered for timed event data
[1428991167] ndomod registered for log data'
[1428991167] ndomod registered for system command data'
[1428991167] ndomod registered for event handler data'
[1428991167] ndomod registered for notification data'
[1428991167] ndomod registered for service check data'
[1428991167] ndomod registered for host check data'
[1428991167] ndomod registered for comment data'
[1428991167] ndomod registered for downtime data'
[1428991167] ndomod registered for flapping data'
[1428991167] ndomod registered for program status data'
[1428991167] ndomod registered for host status data'
[1428991167] ndomod registered for service status data'
[1428991167] ndomod registered for adaptive program data'
[1428991167] ndomod registered for adaptive host data'
[1428991167] ndomod registered for adaptive service data'
[1428991167] ndomod registered for external command data'
[1428991167] ndomod registered for aggregated status data'
[1428991167] ndomod registered for retention data'
[1428991167] ndomod registered for contact data'
[1428991167] ndomod registered for contact notification data'
[1428991167] ndomod registered for acknowledgement data'
[1428991167] ndomod registered for contact status data'
[1428991167] ndomod registered for adaptive contact data'
[1428991167] Event broker module '/usr/local/nagios/bin/ndomod-4x.o' initialized successfully.
[1428991167] Successfully launched command file worker with pid 15368

Re: ndo2db don't write anything to datadase

Posted: Tue Apr 14, 2015 10:15 am
by ssax
Try changing your /usr/local/nagios/etc/nagios.cfg from:

Code: Select all

broker_module=/usr/local/nagios/bin/ndomod-4x.o config_file=/usr/local/nagios/etc/ndomod.cfg
To:

Code: Select all

broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg
Then restart nagios:

Code: Select all

service nagios restart

Re: ndo2db don't write anything to datadase

Posted: Wed Apr 15, 2015 1:13 am
by adengin
ssax, thank you for your adviҁe, but this doesn't work for me.

Code: Select all

[1429077731] Caught SIGTERM, shutting down...
[1429077731] Successfully shutdown... (PID=3073)
[1429077731] Event broker module 'NERD' deinitialized successfully.
[1429077731] ndomod: Shutdown complete.
[1429077731] Event broker module '/usr/local/nagios/bin/ndomod-4x.o' deinitialized successfully.
[1429077732] Nagios 4.0.8 starting... (PID=14612)
[1429077732] Local time is Wed Apr 15 09:02:12 MSK 2015
[1429077732] LOG VERSION: 2.0
[1429077732] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1429077732] qh: core query handler registered
[1429077732] nerd: Channel hostchecks registered successfully
[1429077732] nerd: Channel servicechecks registered successfully
[1429077732] nerd: Channel opathchecks registered successfully
[1429077732] nerd: Fully initialized and ready to rock!
[1429077732] wproc: Successfully registered manager as @wproc with query handler
[1429077732] wproc: Registry request: name=Core Worker 14615;pid=14615
[1429077732] wproc: Registry request: name=Core Worker 14618;pid=14618
[1429077732] wproc: Registry request: name=Core Worker 14619;pid=14619
[1429077732] wproc: Registry request: name=Core Worker 14617;pid=14617
[1429077732] wproc: Registry request: name=Core Worker 14614;pid=14614
[1429077732] wproc: Registry request: name=Core Worker 14616;pid=14616
[1429077732] ndomod: NDOMOD 2.0.0 (02-28-2014) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
[1429077732] ndomod: Successfully connected to data sink.  0 queued items to flush.
[1429077732] ndomod registered for timed event data
[1429077732] ndomod registered for log data'
[1429077732] ndomod registered for system command data'
[1429077732] ndomod registered for event handler data'
[1429077732] ndomod registered for notification data'
[1429077732] ndomod registered for service check data'
[1429077732] ndomod registered for host check data'
[1429077732] ndomod registered for comment data'
[1429077732] ndomod registered for downtime data'
[1429077732] ndomod registered for flapping data'
[1429077732] ndomod registered for program status data'
[1429077732] ndomod registered for host status data'
[1429077732] ndomod registered for service status data'
[1429077732] ndomod registered for adaptive program data'
[1429077732] ndomod registered for adaptive host data'
[1429077732] ndomod registered for adaptive service data'
[1429077732] ndomod registered for external command data'
[1429077732] ndomod registered for aggregated status data'
[1429077732] ndomod registered for retention data'
[1429077732] ndomod registered for contact data'
[1429077732] ndomod registered for contact notification data'
[1429077732] ndomod registered for acknowledgement data'
[1429077732] ndomod registered for contact status data'
[1429077732] ndomod registered for adaptive contact data'
[1429077732] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.

Code: Select all

mysql> select * from nagios_instances;
Empty set (0.00 sec)
I would like to pay attention to the fact that the file ndo2db.debug is empty. Perhaps it could clarify the situation, but logging does not working.

Code: Select all

debug_level=-1

# DEBUG VERBOSITY
# This option determines how verbose the debug log out will be.
# Values: 0 = Brief output
#         1 = More detailed
#         2 = Very detailed

debug_verbosity=2

# DEBUG FILE
# This option determines where the daemon should write debugging information.

debug_file=/usr/local/nagios/var/ndo2db.debug

# MAX DEBUG FILE SIZE
# This option determines the maximum size (in bytes) of the debug file.  If
# the file grows larger than this size, it will be renamed with a .old
# extension.  If a file already exists with a .old extension it will
# automatically be deleted.  This helps ensure your disk space usage doesn't
# get out of control when debugging.

max_debug_file_size=1000000

Code: Select all

root@nagios:~# ls -la /usr/local/nagios/var/ndo2db.debug
-rwxrwxrwx 1 nagios nagios 0 Mar 31 14:52 /usr/local/nagios/var/ndo2db.debug

Re: ndo2db don't write anything to datadase

Posted: Wed Apr 15, 2015 10:17 am
by jolson
Hello,

It's possible that mysql is rejecting the connection attempts from ndo2db because you have granted access through localhost - but not through 127.0.0.1. Could you please change the following config in your ndo2db.cfg:

Code: Select all

db_host=127.0.0.1
to

Code: Select all

db_host=localhost
Then restart ndo2db.

Let me know if that helps. I changed my db_host to '127.0.0.1' and got a refused connection from mysqld:

Code: Select all

150415  8:46:27 [Warning] Aborted connection 2 to db: 'nagios' user: 'nagios' host: 'localhost' (Got an error reading communication packets)

Re: ndo2db don't write anything to datadase

Posted: Thu Apr 16, 2015 8:28 am
by adengin
jolson, hello!

Unfortunately, this change does not lead to positive results.
I don't see any connections to the database in mysql log file and and in traffic flow in tcpdump at all.

Re: ndo2db don't write anything to datadase

Posted: Thu Apr 16, 2015 9:09 am
by ssax
Is selinux enabled?

Code: Select all

sestatus
or

Code: Select all

getenforce

Re: ndo2db don't write anything to datadase

Posted: Thu Apr 16, 2015 9:20 am
by adengin

Code: Select all

root@nagios:~# getenforce
-bash: getenforce: command not found
root@nagios:~# sestatus
-bash: sestatus: command not found

Re: ndo2db don't write anything to datadase

Posted: Thu Apr 16, 2015 9:20 am
by jolson
To see failed mysql connections, you need to alter /etc/my.cnf to match mine:

Code: Select all

#cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-warnings=2
log-error=/var/log/mysqld.log

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Once altered, restart mysql and ndo2db. Are there any login errors?

Re: ndo2db don't write anything to datadase

Posted: Thu Apr 16, 2015 12:08 pm
by adengin
I see no useful information in mysql log file after these changes :(

Re: ndo2db don't write anything to datadase

Posted: Thu Apr 16, 2015 12:19 pm
by jolson
Could you please use the following ndo2db config as a test to see whether this is related to the tcp socket or not?

Code: Select all

lock_file=/usr/local/nagios/var/ndo2db.lock
ndo2db_user=nagios
ndo2db_group=*****
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=*****
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=0
debug_verbosity=1
debug_file=/usr/local/nagios/var/ndo2db.debug
max_debug_file_size=1000000