Using Nagios3 to supervise, monitor your network, via the web interface, you can encounter this kind of error :
Error: Could not stat() command file '/var/lib/nagios3/rw/nagios.cmd'!
First have a quick check, if the file exists, and what are its rights ?
ls -l /var/lib/nagios3/rw/nagios.cmd
Check your nagios.cfg, external command should be enabled, the file should be in /etc/nagios3/nagios.cfg for Debian installs, or can be on /usr/local/nagios/etc/nagios.cfg if you compiled it from sources :
# EXTERNAL COMMAND OPTION
# Values: 0 = disable commands, 1 = enable commands
# EXTERNAL COMMAND FILE
Make your apache user member of the nagios group :
usermod -G nagios www-data
Let’s have a closdest look at the rights, with those rights you should be fine, but still you encounter the same error ?
ls -l /var/lib/nagios3/rw/nagios.cmd prw-rw---- 1 nagios nagios 0 2013-01-27 15:17 /var/lib/nagios3/rw/nagios.cmd
The reason for this is that the parent directory, “rw”, does not allow any user but nagios to access its contents, so all you have to do is add the execute bit on the groups rights, so that apache user can run nagios.cmd
chmod g+x /var/lib/nagios3/rw