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