'Nagios - Could not open command file /usr/local/nagios/var/rw/nagios.cmd’ for update
I'm trying to disable active check for a service through Nagios web interface, but I cant make it. The Nagios instance is running on a Centos 5 distribution
Each time I try to stop the service I get this message : Could not open command file ‘/usr/local/nagios/var/rw/nagios.cmd’ for update!
Although I tried several proposals found on the web :
usermod -a -G nagios apache
chmod 666 /usr/local/nagios/var/rw/nagios.cmd
chown nagios.nagcmd /usr/local/nagios/var/rw
chmod u+rwx /usr/local/nagios/var/rw
chmod g+rwx /usr/local/nagios/var/rw
chmod g+s /usr/local/nagios/var/rw
Each time rebooting nagios service afterwards of course.
Thanks for your help ! Cheers
Solution 1:[1]
Selinux can also cause this problem. You can check its status with:
sestatus
If current mode is enforcing, change it to permissive with:
setenforce 0
Then you may be able to commit your changes into nagios.cmd.
Solution 2:[2]
This is how you have to follow
service httpd stop
service nagios stop
usermod -G nagcmd nagios
usermod -G nagcmd apache
chown nagios:nagcmd /usr/local/nagios/var/rw
chown nagios:nagcmd /usr/local/nagios/var/rw/nagios.cmd
service httpd start
service nagios start
Solution 3:[3]
The following should fix the issue in Debian:
chown -R www-data:www-data /usr/local/nagios/var/
Solution 4:[4]
The only issue with this is selinux. Stop it and it will work fine. Credit goes to Nagios team.
Solution 5:[5]
I haven't seen this mentioned and it caught me out, it's worth checking the apache child processes are running as the apache user.
I built my apache from source and this uses daemon as the default user and group for the child processes so this had to be changed for this to work.
Solution 6:[6]
What worked for me is :
chmod ugo+rw /usr/local/nagios/var/rw/ /usr/local/nagios/var/rw/nagios.cmd
and restarting apache and nagios.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Umut Uzun |
| Solution 2 | Anirudh Sharma |
| Solution 3 | mech |
| Solution 4 | Saurabh Aditya |
| Solution 5 | Rich J |
| Solution 6 | Imran Rentia |
