Page 1 of 1

Could not stat() command file '/usr/local/nagios/var/rw/nagi

Posted: Tue Sep 22, 2015 1:32 pm
by jcb0165
I am getting the following error. I am running Centos7 and Core 4.1.1.


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 searching I have done has said it is a permissions error. I tried a few items but no luck what so ever. Can someone point me in the correct direction

thanks
Jerry

Re: Could not stat() command file '/usr/local/nagios/var/rw/

Posted: Tue Sep 22, 2015 1:42 pm
by hsmith
Hi Jerry,

Can we please get the output of the following?


Check SELinux status:

Code: Select all

getenforce
Check the status of the service:

Code: Select all

systemctl status nagios
Check the configuration for errors:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Permissions:

Code: Select all

ls -l /usr/local/nagios/var
ls -l /usr/local/nagios/var/rw
Check log:

Code: Select all

tail /usr/local/nagios/var/nagios.log
Check groups:

Code: Select all

grep nag /etc/group

Re: Could not stat() command file '/usr/local/nagios/var/rw/

Posted: Fri Sep 25, 2015 10:14 am
by jcb0165
Hello

Thanks for the reply. I uploaded a file to answer commands you gave me to issue.

thanks again
Jerry

Re: Could not stat() command file '/usr/local/nagios/var/rw/

Posted: Fri Sep 25, 2015 10:34 am
by hsmith
Can you disable SELinux and see if this changes anything?

Code: Select all

setenforce 0
Also, run these commands please:

Code: Select all

usermod -G nagios nagios
usermod -G nagcmd apache

Re: Could not stat() command file '/usr/local/nagios/var/rw/

Posted: Fri Sep 25, 2015 11:52 am
by jcb0165
Just after I posted the attachment . I read another article about changing the mode saying

The problem with this issue is definitely with SELinux, if you temporarily set it to permissive mode, all external commands work well

So I did it using the command you just sent. Also I changed the rights on the Nagios.cmd to 666.

It works. But When I reboot the files change back to 660 and it stops working once again. Does this make any sense

Re: Could not stat() command file '/usr/local/nagios/var/rw/

Posted: Fri Sep 25, 2015 12:02 pm
by hsmith
What is the output of a umask command?

Re: Could not stat() command file '/usr/local/nagios/var/rw/

Posted: Fri Sep 25, 2015 12:13 pm
by jcb0165
in that directory I ran Umask

It replys
0022

Re: Could not stat() command file '/usr/local/nagios/var/rw/

Posted: Fri Sep 25, 2015 12:22 pm
by hsmith
That's the output we want. Could we edit SELinux to not start upon boot?

Code: Select all

vi /etc/selinux/config
Change SELINUX=permissive to SELINUX=disabled and reboot.

See if this fixes the issue.

Re: Could not stat() command file '/usr/local/nagios/var/rw/

Posted: Fri Sep 25, 2015 12:37 pm
by jcb0165
That did it!!! I rebooted a few time and we are good. Thanks for all you time and help
take care
Jerry

Re: Could not stat() command file '/usr/local/nagios/var/rw/

Posted: Fri Sep 25, 2015 12:39 pm
by hsmith
I'm glad we resolved it. SELinux is kind of a bully sometimes. I'll mark this one resolved and close it. Please let us know if there is anything else we can help you with.