nagios restart from process info page not working

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
avraham
Posts: 27
Joined: Thu Aug 28, 2014 5:37 pm

nagios restart from process info page not working

Post by avraham »

when clicking process info->restart the nagios process->commit

i get the following error :
Error: Could not open command file '/usr/local/nagios/var/rw/nagios.cmd' for update!
The permissions on the external command file and/or directory may be incorrect. Read the FAQs on how to setup proper permissions.
An error occurred while attempting to commit your command for processing.

Return from whence you came
-------------------
/usr/local/nagios/var/rw# ls -l
total 0
srw-rw---- 1 nagios nagcmd 0 Aug 5 08:59 nagios.cmd
srw-rw---- 1 nagios nagcmd 0 Aug 5 08:59 nagios.qh


drwxr-xr-x 10 root root 4096 Oct 4 2015 /usr
drwxrwsr-x 20 root root 4096 Mar 19 16:08 /usr/local
drwxr-sr-x 9 root root 4096 Feb 29 18:01 /usr/local/nagios
drwxrwsr-x 8 nagios nagios 4096 Aug 5 09:25 /usr/local/nagios/var
drwxrwsr-x 2 nagios nagcmd 4096 Aug 5 08:59 /usr/local/nagios/var/rw

i didn't c anything in the faq related to this. i suppose there's are other faq's.
any hints would be appreciated.

i'm running nagios 4.1.1 on debian 8 (jessie)

"service nagios restart" works just fine.

tnx,
ams
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: nagios restart from process info page not working

Post by rkennedy »

Did you follow a specific guide when installing that you can link to us? It sounds like a permission issue at this point.

Looking at my file, it has a p flag and you're seems to have a sticky bit. This will affect how the nagios.cmd file functions.

Code: Select all

[root@localhost rw]# ls -l
total 0
prw-rw---- 1 nagios nagcmd 0 Aug  4 15:02 nagios.cmd
srw-rw---- 1 nagios nagcmd 0 Aug  4 15:01 nagios.qh
Former Nagios Employee
avraham
Posts: 27
Joined: Thu Aug 28, 2014 5:37 pm

Re: nagios restart from process info page not working

Post by avraham »

hi r.k.,
tnx 4 u'r rapid response.

yes, i noticed that p (socket/pipe) instead of s (SUID isn't it? not sticky, which would be indicated by t?)

anyway, it's a socket, not a reg file:
/usr/local/nagios/var/rw# file nagios.cmd
nagios.cmd: socket

attempting to obliterate the s bit is ineffective:
/usr/local/nagios/var/rw# ls -l !$
ls -l nagios.cmd
srw-rw---- 1 nagios nagcmd 0 Aug 8 10:35 nagios.cmd
/usr/local/nagios/var/rw# chmod u-s !$
chmod u-s nagios.cmd
/usr/local/nagios/var/rw# !ls
ls -l nagios.cmd
srw-rw---- 1 nagios nagcmd 0 Aug 8 10:35 nagios.cmd
/usr/local/nagios/var/rw# chmod 660 !$
chmod 660 nagios.cmd
/usr/local/nagios/var/rw# !ls
ls -l nagios.cmd
srw-rw---- 1 nagios nagcmd 0 Aug 8 10:35 nagios.cmd
/usr/local/nagios/var/rw#

deleting nagios.cmd and restarting nagios also results in a new nagios.cmd socket w/ the s bit set:
/usr/local/nagios/var/rw# rm nagios.cmd
/usr/local/nagios/var/rw# ls -l nagios.cmd
ls: cannot access nagios.cmd: No such file or directory
/usr/local/nagios/var/rw# service nagios restart
/usr/local/nagios/var/rw# service npcd restart
/usr/local/nagios/var/rw# service apache2 restart
/usr/local/nagios/var/rw# ls -l nagios.cmd
srw-rw---- 1 nagios nagcmd 0 Aug 8 10:59 nagios.cmd
/usr/local/nagios/var/rw#

any suggestions?

tnx,
ams
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: nagios restart from process info page not working

Post by ssax »

Are you seeing anything in your /usr/local/nagios/var/nagios.log or in /var/log/messages that may be related?

What is the output of these commands:

Code: Select all

chage -l nagios
grep nag /etc/group
sestatus
Are you doing a lot of SNMP traps or passive checks?
avraham
Posts: 27
Joined: Thu Aug 28, 2014 5:37 pm

Re: nagios restart from process info page not working

Post by avraham »

problem solved.
i was erroneously using the same filename for both the socket which livestatus uses, and the pipe, used for external commands.
the socket is nagios.qh. the pipe is nagios.cmd by default.

tnx,
ams
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: nagios restart from process info page not working

Post by tmcdonald »

Great to hear! Can we lock this up now?
Former Nagios employee
Locked