Error: Could not stat() command file ‘/var/lib/nagios3/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.
Return from whence you came
Just do the following
root@nagios:~# ls -l /var/lib/nagios3/rw/nagios.cmd prw-rw---- 1 nagios nagios 0 Aug 11 22:27 /var/lib/nagios3/rw/nagios.cmd root@nagios:~# chmod -R g+x /var/lib/nagios3/rw root@nagios:~# ls -l /var/lib/nagios3/rw/nagios.cmd prw-rwx--- 1 nagios nagios 0 Aug 11 22:27 /var/lib/nagios3/rw/nagios.cmd root@nagios:~# service nagios3 restart
Also change group of the file
root@nagios:~# ls -l /var/lib/nagios3/rw/nagios.cmd prw-rw---- 1 nagios nagios 0 Aug 11 22:27 /var/lib/nagios3/rw/nagios.cmd root@nagios:~# chown nagios:www-data /var/lib/nagios3/rw/nagios.cmd
And also, you may need to do the following and restart apache afterwards
root@nagios:~# usermod -G nagios www-data root@nagios:~# service apache2 restart
Note: This tutorial is written keeping in mind Ubuntu distribution, on CentOS, things are a little different
I have the same issue when having a fresh installation of Naigos Core 3.4.1 on Centos 6.3.
Can you or someone help to resolve the issue?
Billy
Please follow the instructions above
Hi Asim,
In my case:
[root@trynagios3 /] # ls -l /usr/local/nagios/var/rw
total 0
prw-rw—-, 1 nagios nagcmd 0 Oct 26 16:03 nagios.cmd
Following your instruction to modify the group ownership of nagios.cmd does not work for my situation as I got error:
chown: invalid group: ‘nagios”www-data’
What group should I use in my case?
Billy
.
Hi Asim,
I am using Naigos Core 3.4.1 on Centos 6.3. There is no www-data group in my case.
What group should I use?
Billy
In CentOS, its normally apache or similar web-server specific user group
You may need to disable SELINX run $ setenforce 0 and then disanle SELINUX edit /etc/selinux/config
Change SELINUX= enforcing to SELINUX=disabled
Hi Asim,
I meant I got this error:
chown: invalid group: ‘nagios:www-data’
Thanks,
Billy
already replied above. www-data is only for Ubuntu/Debian for CentOS see the web-server specific user
I use apache as the group, but still get the same error.
Any other suggestion?
Billy
I have changed ownership to Apache and it doesn’t work. Surprisingly I have ownership set to nagcmd on Ubuntu and it worked without changing ownership to ‘www-data’. Can you help me with this error. I get this when I am trying to enable notification or send custom notification.
Ab my system (Debian 2.6.32-46) I had to changed the permissions of the directory /var/lib/rw and not the file /var/lib/rw/nagios.cmd.
The explanation is given in the file /etc/nagios3/nagios.cfg (in this file also the path for the command file can be set):
# Permissions should be set at the directory level instead of on the file, as the file is deleted every time its contents are processed.
Thanks mate. Works awesome.