Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 960
renard Avatar asked Oct 01 '14 13:10

renard


3 Answers

This command is wrong:

usermod -a -G nagios apache

The group permissions on your rw directory and nagios.cmd file are nagcmd, not nagios. You need this, instead:

usermod -a -G nagcmd apache

This is what worked for me - or more specifically, on Ubuntu, it's:

usermod -a -G nagios www-data

like image 196
jlemley Avatar answered Nov 05 '22 13:11

jlemley


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.

like image 23
Umut Uzun Avatar answered Nov 05 '22 15:11

Umut Uzun


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
like image 6
decimal Avatar answered Nov 05 '22 15:11

decimal