Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Thursday, October 31, 2013

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!
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.

Open file:
vim /etc/init.d/nagios

Find below mentioned lines: 

chown $NagiosUser:$NagiosGroup $NagiosRunFile
$NagiosBin -d $NagiosCfgFile



Add a simple script: 
bash /root/nag.sh

Save and quit the file, then create a simple script:
# vi /root/nag.sh

Add the following lines in script:
#!/bin/bash
sleep 10
chmod 666 /usr/local/nagios/var/rw/nagios.cmd

// save and quite
chmod 755 nag.sh 

Whenever you restart your nagios our little script will run and give right permissions to our nagios.cmd
If you have any questions or comments, the comments are there for that :)


No comments:

Post a Comment