1

I followed these directions to a tee:

Everything was going well until I actually tried to run this command (there is a typo in the article, I've corrected it here):

/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg

My results:

# /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg 
Could not bind socket: Permission denied

I'm running this command as root already. I chose to use the UNIX socket rather than TCP. The Nagios log shows the following after a fresh reboot but nothing if I try to run that command manually.

[1371152186] ndomod: NDOMOD 1.5.2 (06-08-2012) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
[1371152186] ndomod: Could not open data sink!  I'll keep trying, but some output may get lost...
[1371152186] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.

Looking at the process tree, I see no "ndo" process of any kind running.

Looking at netstat, I see this:

unix  2      [ ACC ]     STREAM     LISTENING     841374 /var/run/saslauthd/mux
unix  2      [ ACC ]     STREAM     LISTENING     840356 @/com/ubuntu/upstart
unix  2      [ ]         DGRAM                    840610 @/org/kernel/udev/udevd
unix  10     [ ]         DGRAM                    841162 /dev/log
unix  2      [ ACC ]     STREAM     LISTENING     841337 /var/lib/mysql/mysql.sock
unix  2      [ ]         DGRAM                    857504 
unix  2      [ ]         DGRAM                    847472 
unix  2      [ ]         DGRAM                    841625 
unix  2      [ ]         DGRAM                    841584 
unix  2      [ ]         DGRAM                    841534 
unix  2      [ ]         DGRAM                    841517 
unix  2      [ ]         DGRAM                    841373 
unix  2      [ ]         DGRAM                    841212 
unix  3      [ ]         DGRAM                    840614 
unix  3      [ ]         DGRAM                    840613 

I tried to enable debugging for this utilility:

debug_level=-1
debug_verbosity=1
debug_file=/usr/local/nagios/var/ndo2db.debug
max_debug_file_size=1000000

But nothing is written to /usr/local/nagios/var/ndo2db.debug.

2 Answers 2

1

It was permissions. This process is trying to start under user "nagios" but root:root is the user:group owner of /usr/local/nagios and user nagios isn't a member of the root group:

# groups nagios
nagios: nagios centreon

Anyway, the solution is (I think):

# chmod -R 770 /usr/local/nagios
# chgrp -R nagios /usr/local/nagios

It now starts right up:

# /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg 
# ps aux | grep ndo
nagios    4423  0.0  0.0   8220   652 ?        Ss   00:14   0:00 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg

If you see any issues with these permissions as they are, please let me know.

# stat /usr/local/nagios
  File: `/usr/local/nagios'
  Size: 4096        Blocks: 8          IO Block: 4096   directory
Device: 18h/24d Inode: 75507753    Links: 5
Access: (0770/drwxrwx---)  Uid: (    0/    root)   Gid: (  499/  nagios)
Access: 2013-06-14 00:16:38.195375728 +0400
Modify: 2013-06-13 22:38:29.836402241 +0400
Change: 2013-06-14 00:16:38.196375599 +0400
0

The error Could not bind socket: Permission denied could be because of write permission on the directory where socket file is being written.

In my case, I had to chmod the /dir/of/socket/fie/ to 777. Process started successfully after this change.

IMO changing the permissions on /usr/local/nagios is not required.. its only the directory where the ndo2db process tries to write a socket file. [ Typically its ../var however this can be configured somewhere else in ndo config files. ]

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .