nagios 页面发送命令异常 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!The permissions on the external command file and/or directory may be incorrect. Read the FAQs on how to setup proper permissions.An error occurred while attempting to commit your command for processing.

这个主要是apache  用户 没有执行权限 /usr/local/nagios/var/rw/nagios.cmd 造成。

分析nagios 启动脚本后发现,nagios 在停止的时候会删除掉 nagios.cmd

测试了一下,有一个比较恶毒的解决办法,就是在nagios  启动脚本/etc/init.d/nagios中修改权限。
即:
start)
echo -n "Starting nagios:"
$NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;
if [ $? -eq 0 ]; then
su - $NagiosUser -c "touch $NagiosVarDir/nagios.log $NagiosRetentionFile"
rm -f $NagiosCommandFile
touch $NagiosRunFile
chown $NagiosUser:$NagiosGroup $NagiosRunFile
$NagiosBin -d $NagiosCfgFile
if [ -d $NagiosLockDir ]; then touch $NagiosLockDir/$NagiosLockFile; fi
echo " done."
  chmod -R 777 $NagiosVarDir/rw
exit 0

启动后即可。


原文地址:http://hi.baidu.com/nessus1/item/863b0a8cee1548c2b17154a4

你可能感兴趣的:(apache,File,command,脚本,nagios,permissions)