Hello everyone,
I am fairly new to nagios. I’ve encountered a problem that is driving me crazy. I’ve installed Nagios, started it, am able to use the web interface to monitor my hosts, but when I try to use the web interface to schedule a host for downtime or make a comment I get the following error:
Error: Could not stat() command file ‘/usr/local/nagios/var/rw/nagios.cmd’!
I’ve followed the instructions for setting .cgi permissions, but I am still getting the error. Any help would be greatly appreciated. Thanks!
-Jarrid
Hello everyone,
Here is the fix. In this example I am running Fedora Core 4. The problem is with SELINUX. To resolve the problem I did the following:
vi /etc/sysconfig/selinux
I THEN CHANGED SELINUX=enforcing to SELINUX=permissive
This file controls the state of SELinux on the system.
SELINUX= can take one of these three values:
enforcing - SELinux security policy is enforced.
permissive - SELinux prints warnings instead of enforcing.
disabled - SELinux is fully disabled.
SELINUX=permissive
SELINUXTYPE= type of policy in use. Possible values are:
targeted - Only targeted network daemons are protected.
strict - Full SELinux protection.
SELINUXTYPE=targeted
Hope this helps!!!
It is SELinux that is causing your error. The problem is that it sets security context on all files.
If you type: ls -laZ on the default /usr/local /var/rw folder, what permissions are returned?
Mine look like this-
[grahama@p550 ~]$ ls -laZ /usr/local/nagios/var/rw
drwxrwsr-x nagios nagcmd system_u:object_r:httpd_sys_script_rw_t .
drwxrwxr-x nagios nagios system_u:object_r:usr_t …
prw-rw---- nagios nagcmd user_u:object_r:httpd_sys_script_rw_t nagios.cmd
Sorry about the wrap.
there is another way to temporarily disable SELinux - simply type setenforce 0 to disable on the fly. 1 will enable it again.
chcon will set these permissions.