If you are running RHEL/CentOS and using SELinux, and you should... be using SELinux... you may have notced the following error when you attempt to submit an immediate check of a host:
Error: Could not stat() command file '/usr/local/nagios/var/rw/nagios.cmd'!
There are a number of ways to see if SELinux is preventing this from working, but the quickest is to
# setenforce 0
-- retry submitting
# setenforce 1
If the above allowed the command to run, then just run this
[root@apoc rw]# chcon -R --reference=/var/www/html /usr/local/nagios/share
[root@apoc rw]# chcon -R --reference=/var/www/html /usr/local/nagios/var
[root@apoc rw]# chcon -R --reference=/var/www/cgi-bin /usr/local/nagios/sbin
[root@apoc rw]# chcon -R -t httpd_sys_rw_content_t /usr/local/nagios/var/rw
Out of all of the comments, posts, replies that say to just disable or set SELinux to permissive, this is what we needed. Hopefully it eventually ends up at the top of the searches. Thank you!
ReplyDelete