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

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
happy
Posts: 20
Joined: Wed Nov 28, 2012 4:37 pm

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

Post 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!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

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

Post 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.
happy
Posts: 20
Joined: Wed Nov 28, 2012 4:37 pm

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

Post 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!
happy
Posts: 20
Joined: Wed Nov 28, 2012 4:37 pm

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

Post by happy »

duplicate ....
Last edited by happy on Wed Nov 28, 2012 6:16 pm, edited 1 time in total.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

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

Post by slansing »

Alright! Sounds good :)
AlexeyKozik
Posts: 1
Joined: Tue Jun 25, 2013 10:07 am

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

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

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

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