Nagios Stuff

root's picture

Error: Could not stat() command file

Problem:
When trying to "Re-schedule the next check of this service" and you get this error: Error: Could not stat() command file ‘/var/lib/nagios3/rw/nagios.cmd’!

Solution:

22:15:38 [root@pluto ~]# /etc/init.d/nagios3  stop
Stopping nagios3 monitoring daemon: nagios3
.
22:15:48 [root@pluto ~]# dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
22:15:58 [root@pluto ~]# dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
22:16:17 [root@pluto ~]# /etc/init.d/nagios3  start
Starting nagios3 monitoring daemon: nagios3.

Now the error is no more.

The solution above is for debian based but actually they are just fancy commands for a simple problem: permissions.
As stated in one debian bug report (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571801), this is actually not a bug:

Nagios 3 is not configured to look for external commands in the default configuration as a security feature. To enable external commands, you need to allow the web server write access to the nagios command pipe. the simplest way of doing this is to set check_external_commands=1 in your nagios configuration, and then change the permissions in a way which will be maintained across package upgrades (otherwise dpkg will overwrite your permission changes).
[...]
This is done by intention and will not fixed.

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content