Error: Could not open command file '/usr/local/nagios/var/rw

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
tanay.more
Posts: 2
Joined: Mon Dec 04, 2017 11:08 am

Error: Could not open command file '/usr/local/nagios/var/rw

Post by tanay.more »

When I try to disable notification for any host it shows error as "Error: Could not open command file '/usr/local/nagios/var/rw/nagios.cmd' for update!".

Sharing screenshots for your reference.
Attachments
Capture.PNG
Capture.PNG (11.04 KiB) Viewed 6139 times
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Error: Could not open command file '/usr/local/nagios/va

Post by mcapra »

What documentation did you use to install Nagios Core?

The "Install Command Mode" step of the official documentation typically takes care of this. Can you share the output of the following command executed from the CLI of your Nagios Core machine:

Code: Select all

ls -al /usr/local/nagios/var/rw/
If you attempted to create that file by hand, know that it must exist as a named pipe with the sticky-bit set in the permissions.

To set the sticky-bit by hand:

Code: Select all

chmod g+s /usr/local/nagios/var/rw/
Former Nagios employee
https://www.mcapra.com/
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error: Could not open command file '/usr/local/nagios/va

Post by tgriep »

Thanks @mcapra for the help.
@tanay.more let us know if this fixes the issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
tanay.more
Posts: 2
Joined: Mon Dec 04, 2017 11:08 am

Re: Error: Could not open command file '/usr/local/nagios/va

Post by tanay.more »

Thanks for your help.

Please find status on your query below.

What documentation did you use to install Nagios Core?
>>I am sharing my document which I used to installed Nagios Server.

ls -al /usr/local/nagios/var/rw/

[root@blpmweb15 ~]# ls -al /usr/local/nagios/var/rw/
total 4
drwxrwsr-x 2 nagios nagcmd 39 Dec 5 10:11 .
drwxrwxr-x 5 nagios nagios 4096 Dec 5 10:12 ..
prw-rw---- 1 nagios nagcmd 0 Dec 5 10:11 nagios.cmd
srw-rw---- 1 nagios nagcmd 0 Dec 5 10:11 nagios.qh

I tried "chmod g+s /usr/local/nagios/var/rw/" this but still no fix.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error: Could not open command file '/usr/local/nagios/va

Post by tgriep »

Another thing to check is to make sure the nagios user account and the apache user account is added to the nagcmd group and the nagios group on the server.
To do this, edit the following file

Code: Select all

/etc/group
And make sure the nagios and nagcmd groups are configured like the example below.

Code: Select all

nagios:x:1000:nagios,apache
nagcmd:x:1001:nagios,apache
This should allow the nagios user and the apache user account access to that folder and it's files.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked