Error: Could not stat() command file nagios.cmd

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
jim
Posts: 37
Joined: Wed Jun 08, 2016 11:18 am

Error: Could not stat() command file nagios.cmd

Post by jim »

Good Folks,

I have a question on how to resolve the following error:

Code: Select all

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.
I don't want to disable SELINUX as that is what said in general as I believe it is a security risk to disable it.

Furthermore here is the information which is required to troubleshoot the issue.

Code: Select all

[root@puppet local]# ls -l /usr/local/nagios/var/rw/nagios.cmd 
prw-rw----. 1 nagios nagcmd 0 Jul  9 19:43 /usr/local/nagios/var/rw/nagios.cmd
[root@puppet local]# ls -l /usr/local/nagios/var/rw/
total 0
prw-rw----. 1 nagios nagcmd 0 Jul  9 19:43 nagios.cmd
srw-rw----. 1 nagios nagcmd 0 Jul  9 19:43 nagios.qh
[root@puppet local]# ls -ld /usr/local/nagios/var/rw/
drwxrwsr-x. 2 nagios nagcmd 4096 Jul  9 19:43 /usr/local/nagios/var/rw/
[root@puppet local]# grep nag /etc/group
nagios:x:492:nagios
nagcmd:x:501:apache
[root@puppet local]# 

Code: Select all

[root@puppet etc]# cat cgi.cfg |grep authorized
authorized_for_system_information=nagios
authorized_for_configuration_information=nagios
authorized_for_system_commands=nagios
authorized_for_all_services=nagios
authorized_for_all_hosts=nagios
authorized_for_all_service_commands=nagios
authorized_for_all_host_commands=nagios
#authorized_for_read_only=user1,user2
[root@puppet etc]# 
Let me know if you need any further information.

Regards,
Jim
jim
Posts: 37
Joined: Wed Jun 08, 2016 11:18 am

Re: Error: Could not stat() command file nagios.cmd

Post by jim »

Any update ? as I only see disabling SELINUX as the only viable solution. Disabling SELINUX is a security risk.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Error: Could not stat() command file nagios.cmd

Post by Box293 »

As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jim
Posts: 37
Joined: Wed Jun 08, 2016 11:18 am

Re: Error: Could not stat() command file nagios.cmd

Post by jim »

Nope, Better article I think is this:
http://markelov.org/wiki/index.php/Nagios_and_SELinux

Doesn't work for me. What I do understand from CentOS is they recommend installing it with yum package. However that is old nagios (3.5). Compiling from source gives 4.1.1

I really want this to work but without disabling SELINUX............ I am stuck and thinking that I should disable SELINUX....
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Error: Could not stat() command file nagios.cmd

Post by tmcdonald »

Try disabling SELinux for just a moment and see if the error goes away. If it does, you can re-enable SELinux and configure it as needed:

https://access.redhat.com/documentation ... ors_Guide/
Former Nagios employee
Locked