Page 1 of 1

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

Posted: Wed Nov 28, 2012 4:56 pm
by happy
Hello

This is my first attempt to get Nagios working. I have installed it on CentOS 6.3. I followed a couple different tutorials online to attempt to configure it. I am also, fairly new to Linux.

At this point everything else is working except 2 things, one of which is as follow:

- when I login to web interface and try to run any host commands, (ie, Enable checks of all services on this host) and hit Commit, I get an error message:

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 permissions on the file in question are as this:
prw-rw----. 1 nagios nagcmd 0 Nov 28 13:34 nagios.cmd

In an attempt to troubleshoot this I have given full permissions 777 to this file but that also does not fix the issue. It also seems interesting that this file is of o bytes, is it supposed to be?

I would appreciate if anyone with experience in setting Nagios up can guide.

THANKS!

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

Posted: Wed Nov 28, 2012 5:03 pm
by slansing
Hi happy,

SElinux can throw some strange errors and not allow you to connect with the cgi's on certain stock Distro setups. What version of Core, and Nagios Plugins are you using? Can you run the following:

Code: Select all

getenforce
if it is enabled run:

Code: Select all

setenforce 0

Code: Select all

service nagios restart
Let me know if this helps.

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

Posted: Wed Nov 28, 2012 5:30 pm
by happy
Hi slansing

That's fixed it!!! I like to thank you for sharing your knowledge and giving you time to my question. I had spent many hours searching for it online ...

Many Thanks!

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

Posted: Wed Nov 28, 2012 5:32 pm
by happy
duplicate ....

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

Posted: Wed Nov 28, 2012 5:36 pm
by slansing
Alright! Sounds good :)

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

Posted: Fri Dec 18, 2015 9:43 am
by AlexeyKozik
I know this is an ancient thread, but I just wanted to say thanks. I was having the same issue that I spend almost a full day on, and most of the google searches were leading me to the suggestions that were not helpful in my case.

Thanks slansing!

Alex

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

Posted: Fri Dec 18, 2015 10:08 am
by rkennedy
Glad to see this old thread helped you out! I'm going to close this thread out now, but let us know if you ever need assistance in the future.