NDOutils 2 and Nagios 4.0.4

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.
spacemanspiff
Posts: 22
Joined: Mon Mar 24, 2014 3:53 pm

NDOutils 2 and Nagios 4.0.4

Post by spacemanspiff »

I've been trying to build a Nagios installation as a test, ready to deploy in a corporate environment.

However, I'm having serious issues getting NDOutils to work with Nagios. Nagios is 4.0.4, NDOutils is 2.00 (current versions as of today).

nagios.log seems to have some information (see below), however my NDO debug log is empty despite the verbosity chosen. Currently, Nagios is only monitoring localhost, however that should still provide some output in the database right? As of right now, the entire NDO database contains only one entry in one table:

Code: Select all

ndoutils 1.4b2


Any pointers much appreciated. Logs and config files included.




nagios.log output:

Code: Select all

[1395752528] Nagios 4.0.4 starting... (PID=1333)
[1395752528] Local time is Tue Mar 25 09:02:08 EDT 2014
[1395752528] LOG VERSION: 2.0
[1395752528] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1395752528] qh: core query handler registered
[1395752528] nerd: Channel hostchecks registered successfully
[1395752528] nerd: Channel servicechecks registered successfully
[1395752528] nerd: Channel opathchecks registered successfully
[1395752528] nerd: Fully initialized and ready to rock!
[1395752528] wproc: Successfully registered manager as @wproc with query handler
[1395752528] wproc: Registry request: name=Core Worker 1336;pid=1336
[1395752528] wproc: Registry request: name=Core Worker 1337;pid=1337
[1395752528] wproc: Registry request: name=Core Worker 1338;pid=1338
[1395752528] wproc: Registry request: name=Core Worker 1339;pid=1339
[1395752528] ndomod: NDOMOD 2.0.0 (10-30-2012) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
[1395752528] ndomod: Could not open data sink!  I'll keep trying, but some output may get lost...
[1395752528] ndomod registered for contact data'
[1395752528] ndomod registered for contact notification data'
[1395752528] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.
[1395752528] Successfully launched command file worker with pid 1341
[1395756127] Auto-save of retention data completed successfully.
[1395759727] Auto-save of retention data completed successfully.
[1395763327] Auto-save of retention data completed successfully.
[1395766927] Auto-save of retention data completed successfully.
[1395770527] Auto-save of retention data completed
My ndo2db.cfg file:

Code: Select all

#####################################################################
# NDO2DB DAEMON CONFIG FILE
#
# Last Modified: 01-02-2009
#####################################################################



# LOCK FILE
# This is the lockfile that NDO2DB will use to store its PID number
# in when it is running in daemon mode.

lock_file=/usr/local/nagios/var/ndo2db.lock



# USER/GROUP PRIVILIGES
# These options determine the user/group that the daemon should run as.
# You can specify a number (uid/gid) or a name for either option.

ndo2db_user=nagios
ndo2db_group=nagcmd



# SOCKET TYPE
# This option determines what type of socket the daemon will create
# an accept connections from.
# Value:
#   unix = Unix domain socket (default)
#   tcp  = TCP socket

socket_type=unix
#socket_type=tcp



# SOCKET NAME
# This option determines the name and path of the UNIX domain 
# socket that the daemon will create and accept connections from.
# This option is only valid if the socket type specified above
# is "unix".

socket_name=/usr/local/nagios/var/ndo.sock



# TCP PORT
# This option determines what port the daemon will listen for
# connections on.  This option is only vlaid if the socket type
# specified above is "tcp".

tcp_port=5668



# ENCRYPTION
# This option determines if the ndo2db daemon will accept SSL to encrypt the 
# network traffic between module and ndo2db daemon.
# Both sides have to enable this feature which depends on SSL Libraries
# like openssl or kerberos 
# This option is only valid if the output type
# option specified above is "tcpsocket".
#
# A value of '1' will enable this feature

use_ssl=0



# DATABASE SERVER TYPE
# This option determines what type of DB server the daemon should
# connect to.
# Values:
# 	mysql = MySQL
#       pgsql = PostgreSQL

db_servertype=mysql



# DATABASE HOST
# This option specifies what host the DB server is running on.

db_host=localhost



# DATABASE PORT
# This option specifies the port that the DB server is running on.
# Values:
# 	3306 = Default MySQL port
#	5432 = Default PostgreSQL port

db_port=3306



# DATABASE NAME
# This option specifies the name of the database that should be used.

db_name=database



# DATABASE TABLE PREFIX
# Determines the prefix (if any) that should be prepended to table names.
# If you modify the table prefix, you'll need to modify the SQL script for
# creating the database!

db_prefix=nagios_



# DATABASE USERNAME/PASSWORD
# This is the username/password that will be used to authenticate to the DB.
# The user needs at least SELECT, INSERT, UPDATE, and DELETE privileges on
# the database.

db_user=username
db_pass=password



## TABLE TRIMMING OPTIONS
# Several database tables containing Nagios event data can become quite large
# over time.  Most admins will want to trim these tables and keep only a
# certain amount of data in them.  The options below are used to specify the
# age (in MINUTES) that data should be allowd to remain in various tables
# before it is deleted.  Using a value of zero (0) for any value means that
# that particular table should NOT be automatically trimmed.

# Keep timed events for 24 hours
max_timedevents_age=1440

# Keep system commands for 1 week
max_systemcommands_age=10080

# Keep service checks for 1 week
max_servicechecks_age=10080

# Keep host checks for 1 week
max_hostchecks_age=10080

# Keep event handlers for 31 days
max_eventhandlers_age=44640

# Keep external commands for 31 days
max_externalcommands_age=44640

# Keep notifications for 31 days
max_notifications_age=44640

# Keep contactnotifications for 31 days
max_contactnotifications=44640

# Keep contactnotificationmethods for 31 days
max_contactnotificationmethods=44640

# Keep logentries for 90 days
max_logentries_age=129600

# Keep acknowledgements for 31 days
max_acknowledgements_age=44640



# DEBUG LEVEL
# This option determines how much (if any) debugging information will
# be written to the debug file.  OR values together to log multiple
# types of information.
# Values: -1 = Everything
#          0 = Nothing
#          1 = Process info
#	   2 = SQL queries

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
My ndomod.cfg file:

Code: Select all

#####################################################################
# NDOMOD CONFIG FILE
#
# Last Modified: 09-05-2007
#####################################################################


# INSTANCE NAME
# This option identifies the "name" associated with this particular
# instance of Nagios and is used to seperate data coming from multiple
# instances.  Defaults to 'default' (without quotes).

instance_name=default



# OUTPUT TYPE
# This option determines what type of output sink the NDO NEB module
# should use for data output.  Valid options include:
#   file       = standard text file
#   tcpsocket  = TCP socket
#   unixsocket = UNIX domain socket (default)

#output_type=file
#output_type=tcpsocket
output_type=unixsocket



# OUTPUT
# This option determines the name and path of the file or UNIX domain 
# socket to which output will be sent if the output type option specified
# above is "file" or "unixsocket", respectively.  If the output type
# option is "tcpsocket", this option is used to specify the IP address
# of fully qualified domain name of the host that the module should
# connect to for sending output.

#output=/usr/local/nagios/var/ndo.dat
#output=127.0.0.1
output=/usr/local/nagios/var/ndo.sock



# TCP PORT
# This option determines what port the module will connect to in
# order to send output.  This option is only valid if the output type
# option specified above is "tcpsocket".

tcp_port=5668



# ENCRYPTION
# This option determines if the module will use SSL to encrypt the 
# network traffic between module and ndo2db daemon.
# Both sides have to enable this feature which depends on SSL Libraries
# like openssl or kerberos 
# This option is only valid if the output type
# option specified above is "tcpsocket".
#
# A value of '1' will enable this feature

use_ssl=0



# OUTPUT BUFFER
# This option determines the size of the output buffer, which will help
# prevent data from getting lost if there is a temporary disconnect from
# the data sink.  The number of items specified here is the number of
# lines (each of variable size) of output that will be buffered.

output_buffer_items=5000



# BUFFER FILE
# This option is used to specify a file which will be used to store the
# contents of buffered data which could not be sent to the NDO2DB daemon
# before Nagios shuts down.  Prior to shutting down, the NDO NEB module
# will write all buffered data to this file for later processing.  When
# Nagios (re)starts, the NDO NEB module will read the contents of this
# file and send it to the NDO2DB daemon for processing.

buffer_file=/usr/local/nagios/var/ndomod.tmp



# FILE ROTATION INTERVAL
# This option determines how often (in seconds) the output file is
# rotated by Nagios.  File rotation is handled by Nagios by executing
# the command defined by the file_rotation_command option.  This
# option has no effect if the output_type option is a socket.

file_rotation_interval=14400



# FILE ROTATION COMMAND
# This option specified the command (as defined in Nagios) that is
# used to rotate the output file at the interval specified by the
# file_rotation_interval option.  This option has no effect if the
# output_type option is a socket.
#
# See the file 'misccommands.cfg' for an example command definition
# that you can use to rotate the log file.

#file_rotation_command=rotate_ndo_log



# FILE ROTATION TIMEOUT
# This option specified the maximum number of seconds that the file
# rotation command should be allowed to run before being prematurely
# terminated.

file_rotation_timeout=60



# RECONNECT INTERVAL
# This option determines how often (in seconds) that the NDO NEB
# module will attempt to re-connect to the output file or socket if
# a connection to it is lost.

reconnect_interval=15



# RECONNECT WARNING INTERVAL
# This option determines how often (in seconds) a warning message will
# be logged to the Nagios log file if a connection to the output file
# or socket cannot be re-established.

reconnect_warning_interval=15
#reconnect_warning_interval=900



# DATA PROCESSING OPTIONS
# These options determine what data the NDO NEB Module will process
#
acknowledgement_data=1
adaptive_contact_data=1
adaptive_host_data=1
adaptive_program_data=1
adaptive_service_data=1
aggregated_status_data=1
comment_data=1
contact_status_data=1
downtime_data=1
event_handler_data=1
external_command_data=1
flapping_data=1
host_check_data=1
host_status_data=1
log_data=1
main_config_data=1
notification_data=1
object_config_data=1
process_data=1
program_status_data=1
retention_data=1
service_check_data=1
service_status_data=1
statechange_data=1
system_command_data=1
timed_event_data=1


# CONFIG OUTPUT OPTION
# This option determines what types of configuration data the NDO
# NEB module will dump from Nagios.  Values can be OR'ed together.
# Values: 
# 	  0 = Don't dump any configuration information
#         1 = Dump only original config (from config files)
#         2 = Dump config only after retained information has been restored
#         3 = Dump both original and retained configuration

config_output_options=1
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NDOutils 2 and Nagios 4.0.4

Post by abrist »

spacemanspiff wrote:[1395752528] ndomod: Could not open data sink! I'll keep trying, but some output may get lost...
Is mysql running?

Code: Select all

service mysqld status
What are the permission on your debug file?

Code: Select all

ls -la /usr/local/nagios/var/ndo2db.debug
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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: NDOutils 2 and Nagios 4.0.4

Post by tmcdonald »

Also just in case it becomes relevant, what OS and version are you installing on?
Former Nagios employee
spacemanspiff
Posts: 22
Joined: Mon Mar 24, 2014 3:53 pm

Re: NDOutils 2 and Nagios 4.0.4

Post by spacemanspiff »

CentOS 6.5 x64. A clean install. For the final rollout I'll likely build only one on CentOS, the rest will be Oracle Linux 6.5.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NDOutils 2 and Nagios 4.0.4

Post by scottwilkerson »

Does the ndo2db file you are using actually have the correct database name/username/password?
Also, is ndoutils running?

Code: Select all

service ndo2db status
What is the output of

Code: Select all

ls -la /usr/local/nagios/var
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
spacemanspiff
Posts: 22
Joined: Mon Mar 24, 2014 3:53 pm

Re: NDOutils 2 and Nagios 4.0.4

Post by spacemanspiff »

Code: Select all

[root@nagios ~]# service ndo2db status
ndo2db (pid 1350) is running...

Code: Select all

[root@nagios ~]# ls -la /usr/local/nagios/var
total 116
drwxrwxr-x. 5 nagios nagios  4096 Apr  7 12:55 .
drwxr-xr-x. 9 root   root    4096 Mar 24 10:42 ..
drwxrwxr-x. 2 nagios nagios  4096 Mar 24 10:42 archives
-rw-r--r--. 1 nagios nagios     5 Apr  7 12:26 nagios.lock
-rw-r--r--. 1 nagios nagios 18292 Apr  7 12:26 nagios.log
-rw-r--r--. 1 nagios nagcmd     0 Mar 24 14:49 ndo2db.debug
-rw-r--r--. 1 nagios nagios     5 Apr  7 12:26 ndo2db.lock
srwxr-xr-x. 1 nagios nagcmd     0 Apr  7 12:26 ndo.sock
-rw-r--r--. 1 nagios nagios 12647 Apr  7 12:26 objects.cache
-rw-r--r--. 1 nagios nagios 12647 Apr  7 12:26 objects.precache
-rw-------. 1 nagios nagios 13034 Apr  7 12:26 retention.dat
drwxrwsr-x. 2 nagios nagcmd  4096 Apr  7 12:26 rw
drwxr-xr-x. 3 root   root    4096 Mar 24 10:42 spool
-rw-rw-r--. 1 nagios nagios 13458 Apr  7 12:55 status.dat

Sorry it took so long to reply, now back on this trying to finally figure things out!
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NDOutils 2 and Nagios 4.0.4

Post by abrist »

Lets alter the permissions on the debug file and then restart the relevant processes:

Code: Select all

chown nagios:nagios /usr/local/nagios/var/ndo2db.debug
chmod go+w /usr/local/nagios/var/ndo2db.debug
service nagios restart
service ndo2db restart
Wait 5 minutes and then send a tail of:

Code: Select all

tail -25 /usr/local/nagios/var/ndo2db.debug
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.
spacemanspiff
Posts: 22
Joined: Mon Mar 24, 2014 3:53 pm

Re: NDOutils 2 and Nagios 4.0.4

Post by spacemanspiff »

Ran all the commands above, here's the ls output again:

Code: Select all

drwxrwxr-x. 5 nagios nagios  4096 Apr  7 15:59 .
drwxr-xr-x. 9 root   root    4096 Mar 24 10:42 ..
drwxrwxr-x. 2 nagios nagios  4096 Mar 24 10:42 archives
-rw-r--r--. 1 nagios nagios     5 Apr  7 15:51 nagios.lock
-rw-r--r--. 1 nagios nagios 24104 Apr  7 15:58 nagios.log
-rw-rw-rw-. 1 nagios nagios     0 Mar 24 14:49 ndo2db.debug
-rw-r--r--. 1 nagios nagios     5 Apr  7 15:51 ndo2db.lock
srwxr-xr-x. 1 nagios nagcmd     0 Apr  7 15:51 ndo.sock
-rw-r--r--. 1 nagios nagios 12647 Apr  7 15:51 objects.cache
-rw-r--r--. 1 nagios nagios 12647 Apr  7 15:51 objects.precache
-rw-------. 1 nagios nagios 13034 Apr  7 15:51 retention.dat
drwxrwsr-x. 2 nagios nagcmd  4096 Apr  7 15:51 rw
drwxr-xr-x. 3 root   root    4096 Mar 24 10:42 spool
-rw-rw-r--. 1 nagios nagios 13508 Apr  7 15:59 status.dat

After ten minutes, and having submitted warning and critical passive check results for two services to hopefully ensure some output:

Code: Select all

# tail -25 /usr/local/nagios/var/ndo2db.debug
#
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NDOutils 2 and Nagios 4.0.4

Post by scottwilkerson »

The . after the permissions on the files makes me believe you have other acl permissions on these files...

Is selinux enabled or disabled?

Code: Select all

getenforce
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
spacemanspiff
Posts: 22
Joined: Mon Mar 24, 2014 3:53 pm

Re: NDOutils 2 and Nagios 4.0.4

Post by spacemanspiff »

This is a standard, base install of CentOS 6.5. I have done nothing but install it in a VM and then add Nagios.

Code: Select all

# getenforce
Enforcing
I'm not entirely sure how the above happens, as the first thing I do when I install any RHEL based linux is disable SELINUX in /etc/sysconfig/selinux and reboot:

Code: Select all

[root@nagios html]# getenforce
Enforcing
[root@nagios html]# cat /etc/sysconfig/selinux 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 


[root@nagios html]# reboot

Broadcast message from root@nagios.################
	(/dev/pts/0) at 00:00 ...

The system is going down for reboot NOW!
[root@nagios html]# Connection to 000.000.000.000 closed by remote host.
Connection to 000.000.000.000 closed.
$ ssh root@000.000.000.000
root@000.000.000.000's password: 
Last login: 00:00 from 000.000.000.000
[root@nagios ~]# cat /etc/sysconfig/selinux 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 


[root@nagios ~]# getenforce
Enforcing
..I don't understand this entirely. If it's disabled and there's been a restart, how is it on?
Locked