"Error: Could not open command file"

Hello
Whenever I try to use features such as “acknowledge this problem” i get a message reading;-

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.

I have checked the physical permissions to the /usr/local/nagios/var folder and “nagiosadmin” (which is the one and only user of this system on my network) has RWX permissions.

I have tried to understand the FAQs and I appear to have everything set up in the config files OK, HOWEVER, there is one line which is causing me a little confusion (from the Help/FAQ’s nagios.sourceforge.net/docs/2_0/cgiauth.html)

“Authenticated contacts* are granted the following permissions for each host for which they are contacts (but not for hosts for which they are not contacts)…”

Do I need to specify in each host (eg in windows.cfg) a contact? If so, how? I tried to add the directive like so:-

define host{
use windows-server ; Inherit default values from a template
host_name bgrlaptop ; The name we’re giving to this host
alias bgrlaptop ; A longer name associated with the host
address 192.168.1.203 ; IP address of the host
** contact nagiosadmin **
}

but when I verified the file, it threw an error :-

login as: root
Using keyboard-interactive authentication.
Password:
Last login: Fri Feb 29 20:23:18 2008 from 192.168.1.203
Have a lot of fun…
bgrsvr01:~ # /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios 3.0rc2
Copyright © 1999-2008 Ethan Galstad (nagios.org)
Last Modified: 01-29-2008
License: GPL

Reading configuration data…

Error: Invalid host object directive ‘contact’.
Error: Could not add object property in file ‘/usr/local/nagios/etc/objects/windows.cfg’ on line 37.

***> One or more problems was encountered while processing the config files…

 Check your configuration file(s) to ensure that they contain valid
 directives and data defintions.  If you are upgrading from a previous
 version of Nagios, you should be aware that some variables/definitions
 may have been removed or modified in this version.  Make sure to read
 the HTML documentation regarding the config files, as well as the
 'Whats New' section to find out what has changed.

bgrsvr01:~ #

I am certain this is another ‘user-error’ on my behalf as I have only used nagios for less than 1 week but I get the general theory behind it; so if anyone can shed any light on it, i appreciate it very much!
regards

(ps. I am using the latest nagios r3 and plugins on opensuse 10.3)

ok, well after much tinkering, i have managed to get it working
i had to chmod the file /usr/local/nagios/var/rw/nagios.cmd to allow RW to “others”

Now, nagiosadmin can do things like adding comments and so on.
There still remains a mystery that whenever nagios service is restarted, the permissions on this file reset :\

In fact, nagios deletes and recreates this file whenever it restarts.
I assume it is because this file has “weird” rights (prw-rw---- => p for piped file).

btw: nagios doesn’t deletes/creates this file when you “reload” it :slight_smile: