Problem to run external command

I got an error when I was in External Command Interface. After I clicked the commit button, I got the following error:

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 whil attempting to commit your command by processing.

Please help.

Kevin

does the file exist? are permissions set according to the docs? are external commands enabled in nagios.cfg?

Luca

The file exist and permissions are set according to the FAQ’s doc. External commands are also enabled in nagios.cfg.

Looks like everything should be ok. However, …

Do you have any idea? Thanks!

Kevin

ls -la /usr/local/nagios/var is???
ps -ef|grep nagios to get user that runs the nagios proc is ?
ps -ef|grep httpd user that runs httpd is?
Now, those 2 users that you just found, are they of proper user/group to access rw from the ls -la above?
nagios.sourceforge.net/docs/1_0/commandfile.html

Those 2 users (nagios & apache) have proper access to rw folder. Here below is the output for your information. Moreover, my setup have already configured as the url link. Any idea? Thanks!

Kevin

[root@kevinluxws ~]# ls -la /usr/local/nagios/var
total 72
drwxrwxr-x 4 nagios nagios 4096 Oct 29 10:52 .
drwxr-xr-x 9 nagios nagios 4096 Oct 26 16:46 …
drwxrwxr-x 2 nagios nagios 4096 Oct 28 00:00 archives
-rw-rw-r-- 1 nagios nagios 0 Oct 29 10:49 comment.log
-rw-rw-r-- 1 nagios nagios 0 Oct 29 10:49 downtime.log
-rw-r–r-- 1 root root 5 Oct 29 10:49 nagios.lock
-rw-rw-r-- 1 nagios nagios 2759 Oct 29 10:49 nagios.log
drwxrwsr-t 4 nagios nagcmd 4096 Oct 29 10:49 rw
-rw-rw-r-- 1 nagios nagios 1102 Oct 29 10:52 status.log
-rw-r–r-- 1 nagios nagios 830 Oct 29 10:49 status.sav
[root@kevinluxws ~]# ps -ef|grep nagios
nagios 2698 1 0 10:49 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
root 3370 3176 0 10:52 pts/1 00:00:00 grep nagios
[root@kevinluxws ~]# ps -ef |grep httpd
root 2552 1 0 10:49 ? 00:00:00 /usr/sbin/httpd
apache 2575 2552 0 10:49 ? 00:00:00 /usr/sbin/httpd
apache 2576 2552 0 10:49 ? 00:00:00 /usr/sbin/httpd
apache 2577 2552 0 10:49 ? 00:00:00 /usr/sbin/httpd
apache 2578 2552 0 10:49 ? 00:00:00 /usr/sbin/httpd
apache 2579 2552 0 10:49 ? 00:00:00 /usr/sbin/httpd
apache 2580 2552 0 10:49 ? 00:00:00 /usr/sbin/httpd
apache 2581 2552 0 10:49 ? 00:00:00 /usr/sbin/httpd
apache 2582 2552 0 10:49 ? 00:00:00 /usr/sbin/httpd
root 3374 3176 0 10:52 pts/1 00:00:00 grep httpd
[root@kevinluxws ~]# lid -g nagcmd
apache(uid=48)
nagios(uid=501)

In nagios.cfg what is:
check_external_commands=???
command_check_interval=???
command_file=??
Are you authenticating?
You must restart nagios and the httpd.

In cgi.cfg what is…
authorized_for_all_service_commands=??
authorized_for_all_host_commands=??
authorized_for_system_commands=??
And who are you authenticating as?
If you aren’t authenticating, what is…
default_user_name=

Please see my reply below in bold:

In nagios.cfg what is:
check_external_commands=??? 1
command_check_interval=??? 1
command_file=?? /usr/local/nagios/var/rw/nagios.cmd
Are you authenticating? I was authenticated as nagiosadmin in Nagios
You must restart nagios and the httpd. -> Yes

In cgi.cfg what is…
authorized_for_all_service_commands=?? nagiosadmin
authorized_for_all_host_commands=?? nagiosadmin
authorized_for_system_commands=?? nagiosadmin
And who are you authenticating as? I was authenticated as root in FC4
If you aren’t authenticating, what is…
default_user_name= root

Please ignore my previous post due to typing mistake. Moreover, I tried to re-install nagios to a fresh FC4 linux machine. However, I got the same error.

Please see my reply below in bold:

In nagios.cfg what is:
check_external_commands=??? 1
command_check_interval=???** -1**
command_file=?? /usr/local/nagios/var/rw/nagios.cmd **
Are you authenticating?
I was authenticated as nagiosadmin in Nag**ios
You must restart nagios and the httpd. -> Yes

In cgi.cfg what is…
authorized_for_all_service_commands=?? nagiosadmin
authorized_for_all_host_commands=?? nagiosadmin
authorized_for_system_commands=?? nagiosadmin
And who are you authenticating as? **I was authenticated as root in FC4 **
If you aren’t authenticating, what is…
default_user_name= root

I am sorry for the mistake again, the default_user_name in cgi.cfg is commented out (i.e. #default_user_name=guest).

Kevin

Don’t know if it is related but is SELinux disabled?

Luca

I guess SELinux is enabled as I didn’t change much settings after FC4 installation. Is there any way I can disable SELinux to have a try? (I am sorry that I am new to Linu:evil:. Thanks!

Kevin

no idea i don’t use Fedora… but i suppose you could try setup and see if you have the option… or the selinux command possibly. if all fails have a search in teh forum… i’m quite sure it has been discussed preiously :wink:

Luca

You are right. My problem is coming from SELinux. After I disable SELinux in FC4, it is working. I also did some testing and found that only enable “Disable SELinux protection for httpd daemon” setting is enough.

Thanks a lot to all of you!

Kevin