External commands permissions


I’ve just finished reading through the posts i’ve found searching for external commands information.

I’ve walked through the Nagios docs on setting up permissions for the rw folder, for the nagios.cmd file. Nagios is creating the .cmd file successfully, but apache isn’t liking it too much.

I get the following error when trying to process any of the host commands…

Error: Could not stat() command file ‘/usr/local/nagios/var/rw/nagios.cmd’!

The external command file may be missing, Nagios may not be running, and/or Nagios may not be checking external commands.

An error occurred while attempting to commit your command for processing.

The RW folder and its permissions
drwxrwsr-x 2 nagios nagiocmd 4096 Jul 6 17:21 rw

The files inside rw
drwxrwsr-x 2 nagios nagiocmd 4096 Jul 6 17:21 .
drwxrwxr-x 4 nagios nagios 4096 Jul 6 17:22 …
-rwxr-xr-x 1 nagios nagiocmd 901 Jul 6 15:51 disable_active_service_checks
-rwxr-xr-x 1 nagios nagiocmd 825 Jul 6 15:51 disable_notifications
-rwxr-xr-x 1 nagios nagiocmd 900 Jul 6 15:51 enable_active_service_checks
-rwxr-xr-x 1 nagios nagiocmd 826 Jul 6 15:51 enable_notifications
-rwxr-xr-x 1 nagios nagiocmd 2036 Jul 6 15:51 handle-master-host-event
-rwxr-xr-x 1 nagios nagiocmd 1232 Jul 6 15:51 handle-master-proc-event
prw-rw---- 1 nagios nagiocmd 0 Jul 6 17:21 nagios.cmd
-rwxr-xr-x 1 nagios nagiocmd 1179 Jul 6 15:51 obsessive_svc_handler
-rwxr-xr-x 1 nagios nagiocmd 1182 Jul 6 15:51 submit_check_result
-rwxr-xr-x 1 nagios nagiocmd 1207 Jul 6 15:51 submit_check_result_via_nsca

Please help :slight_smile:
On a side note, i’ve also had a problem with apache and the cgi files. I had to move the cgi files to /var/www/cgi-bin and recompile to reflect the changes in order for it to work. No matter what permissions i applied to /usr/local/nagios/sbin and the related files, they would not allow executable access to apache. So, this could be the same thing unfortunately.


Aside from this… I just copied in the files from the source distribution. Do i have the files listed properly? Do you just create them and paste in the code from nagios.org?


Does anyone know a good way to troubleshoot if the external command file is even being accessed etc? How do I know where my system’s problem is?


Problem solved via setenforce command.


SELinux problem again. Good find. But the only file in rw that I have is nagios.cmd.
I have no idea where you got those other files. I don’t see them anywhere in my source. Besides, I don’t see in the documentation of nagios, that it instructs you to copy files from source to rw, so beats the heck outa me why you have so many files in rw.