While maintaining an older nagios3 install I recently came across this error:
Could not stat() command file '/var/lib/nagios3/rw/nagios.cmd'!
Easiest solution to this Nagios3 error was to Google it, which came across this post. Reposting the solution here with credit to Barry O'Donovan, as so many times, good snippets like this just disappear from the internet. Pretty sure the next time I need this, I won't remember the solution.
service nagios3 stop dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3 service nagios3 start
What's this do?
dpkg-statoverride is basically what it sounds like. A utility to override the default permissions of directories and devices that an application would like to use. In our case, we are updating the list of overrides by adding two new overrides.