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

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
jcb0165
Posts: 9
Joined: Tue Jun 30, 2015 7:10 am

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

Post 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
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

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

Post 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
Former Nagios Employee.
me.
jcb0165
Posts: 9
Joined: Tue Jun 30, 2015 7:10 am

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

Post by jcb0165 »

Hello

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

thanks again
Jerry
Attachments
nagios.txt
(5.65 KiB) Downloaded 570 times
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

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

Post 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
Former Nagios Employee.
me.
jcb0165
Posts: 9
Joined: Tue Jun 30, 2015 7:10 am

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

Post 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
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

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

Post by hsmith »

What is the output of a umask command?
Former Nagios Employee.
me.
jcb0165
Posts: 9
Joined: Tue Jun 30, 2015 7:10 am

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

Post by jcb0165 »

in that directory I ran Umask

It replys
0022
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

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

Post 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.
Former Nagios Employee.
me.
jcb0165
Posts: 9
Joined: Tue Jun 30, 2015 7:10 am

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

Post by jcb0165 »

That did it!!! I rebooted a few time and we are good. Thanks for all you time and help
take care
Jerry
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

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

Post 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.
Former Nagios Employee.
me.
Locked