Error: Could not stat() command file '/var/lib/nagios3/rw/nagios.cmd'! March 31, 2009
Posted by idimmu in linux, ubuntu.I've been doing a lot of Nagios deployments recently, and this error always bites me, on all Ubuntu versions, including Hardy and Intrepid (haven't quite bit the bullet to try the Jaunty beta yet :) )
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.
This can be quite easily fixed with the following command line fu:
sudo /etc/init.d/nagios3 stop
sudo dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
sudo dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
sudo /etc/init.d/nagios3 start
Now you should be able to send Nagios remote commands and commands via the web interface to your heart's content!
For other tips like this, and useful techniques such as implementing Nagios redundancy and distributed monitoring, I thoroughly recommend this book:

Nagios: System and Network Monitoring



