Error: Could not open command file ‘/usr/local/nagios/var/rw/nagios.cmd’ for update!
Error: Could not open command file ‘/usr/local/nagios/var/rw/nagios.cmd’ for update!,An error that comes up from time to time and is quite annoying to deal with, I found a way to fix the problem, it is not the best way, but it is simple and fast.
Explanation: when nagios starts, it creates a file that will run nagios.cmd our services, excluding, for some, bad rights are granted, the right permissions being 666.
We could grant the nagios rights with a simple chmod, but the problem is that each restart, the nagios.cmd recreates itself … We’ll go through a little hack:
chown $NagiosUser:$NagiosGroup $NagiosRunFile
$NagiosBin -d $NagiosCfgFile
Save & quit, then :
# vi /root/nag.sh
// Add the following lines :
chmod 666 /usr/local/nagios/var/rw/nagios.cmd
// save & quite
chmod 755 nag.sh
Whenever you restart your nagios our little script will run and give right permissions to our nagios.cmd
Feel free to share this article with share buttons !