Error: Could not open command file ‘/var/nagios/rw/nagios.cmd’ for update! Solution.
I’d never in my couple of times of setting Nagios up managed to get the nagios.cmd part to work correctly.
Always getting this common error:
Error: Could not open command file '/var/nagios/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 HAD read the FAQ but it hadn’t helped.
Essentially the nagios.cmd file allows people using the Nagios web interface to do things such as disabled/enable notifications on hosts and servers etc.
I found this worked if I did:
chmod 777 /var/nagios/rw/nagios.cmd
I could then do whatever I liked on the website, so it was an ownership/permissions problem. Searching the internet told me to ensure that the user that my webserver is running as (apache) was a member of the nagioscmd group.
So, I opened up my /etc/group file and added it, tried again after restarting apache and nagios services, same problem, did the chmod 777 and all was well again.
I had considered scripting the chmod command to run, but I thought NO, I’ll fix this.
Found a solution that works enough for me, rather then just adding apache to the nagioscmd group, add apache to the nagios group. I found that the ownership of the file being created was nagios.nagios not nagioscmd.nagioscmd.
This worked for me, try it, it might work for you. I don’t know what other issues this may cause, security or otherwise, but I can’t see it doing too much damage?



5 comments