Error: Could not open command file... nagios.cmd for update!

Hi all,

New to the forum, a complete virgin with Linux and taking baby steps with nagios! Yes im a complete beginner!

Anyhow to the matter on hand.

Latest nagios running on Ubuntu Desktop 11.04 32-bit.

I followed this guide to install
ubuntugeek.com/nagios-networ … 1#comments

If i try to change any settings in the web interface for hosts (such as enable notifications) i get the following error

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 occured while attempting to commit your command for processing

But…

If i run: chmod 777 /usr/local/nagios/var/rw/nagios.cmd

I am able to commit changes using the we interface
That is until the machine is rebooted and then it goes back to Permission denied.

I login to the ubuntu machine as FTLADMIN and there is also a user called NAGIOS created.
I log into the web interface as NAGIOSADMIN

Here is an output from command: ls -al /usr/local/nagios/var

**ftladmin@FTLUBUNTU:~$ ls -al /usr/local/nagios/var

total 84

drwxrwxrwx 4 nagios root 4096 2011-10-21 16:22 .

drwxr-xr-x 9 nagios root 4096 2011-10-20 16:33 …

-rw-r–r-- 1 nagios nagios 4 2011-10-21 16:12 nagios.lock

-rw-r–r-- 1 nagios nagios 5674 2011-10-21 16:12 nagios.log

-rw-r–r-- 1 nagios nagios 14655 2011-10-21 16:12 objects.cache

-rw------- 1 nagios nagios 16530 2011-10-21 16:12 retention.dat

drwxrwsr-x 2 nagios nagios 4096 2011-10-21 16:12 rw

drwxr-xr-x 3 nagios root 4096 2011-10-20 16:41 spool

-rw-rw-r-- 1 nagios nagios 16667 2011-10-21 16:22 status.dat

ftladmin@FTLUBUNTU:~$ **

Here is an output from ls -al /usr/local/nagios/var/rw

**ftladmin@FTLUBUNTU:~$ ls -al /usr/local/nagios/var/rw

total 8

drwxrwsr-x 2 nagios nagios 4096 2011-10-21 16:12 .

drwxrwxrwx 4 nagios root 4096 2011-10-21 16:26 . .

prw-rw---- 1 nagios nagios 0 2011-10-21 16:12 nagios.cmd

ftladmin@FTLUBUNTU:~$ **

After i have run chmod 777 /usr/local/nagios/var/rw/nagios.cmd this is the output of ls -al /usr/local/nagios/var/rw

**ftladmin@FTLUBUNTU:~$ ls -al /usr/local/nagios/var/rw

total 8

drwxrwsr-x 2 nagios nagios 4096 2011-10-21 16:12 .

drwxrwxrwx 4 nagios rott 4096 2011-10-21 16:26 . .

prwxrwxrwx 1 nagios nagios 0 2011-10-21 16:12 nagios.cmd

ftladmin@FTLUBUNTU:~$ **

So how to i permanently have access to this file to make changes with the web interface?

I have read loads of docs that suggest adding the apache user to the nagios group but i dont have an apache user!?

Any help is appreciated.

If you need any more info then please ask - but bear in mind i can write my linux/nagios knowledge on the back of a fag packet!

Cheers guys

I’d recommend you have a look at this guide:

nagios.sourceforge.net/docs/3_0/ … buntu.html

maybe you’ll find some different step :wink:

Hello Luca,

Thankyou for taking time to post on my problem.

Are there any specific steps you think i have missed as as far as i can see the steps put in the official doc u linked to are the same as i have followed from the link i provided, some words are just changed.

I believe i have done everything that the official doc says.?

Regards

I think make install-commandmode would be sthe step most closely relating to your problem but i’m not really sure what differences there might be.

It was a simple recommendation based on the fact that some guides around are for older versions of nagios and normally following the original guide gives less problems… at least from what i’ve seen in a couple of years around here :slight_smile:

If you don’t have anything big ocnfigured yet i’d recommend you try reconfiguring everything starting from scratch, pay particula rattention to users/groups and the commands to run after “make install”

Luca

Ok i do believe i run that command properly.

But what i will do is ill install ubuntu on a seperate disk leaving this install alone as i have spent a fair few hours editing some config files etc that i dont really want to do again.

Ill follow the official guide letter by letter and word by word and see how i get on and ill report back here.

Cheers

you can try, but you should be able to simply copy the config files from one install to the other.

Luca - i have followed the official document to the letter
(well apart from the bit where it says you dont need to add a nagios group on a desktop version)

I have got as far as the

*make install *

command and i have found the problem but i dont know why its done it

The error part of the install from make install command

**for file in includes/rss/*; \

do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/includes/rss; done

/usr/bin/install: omitting directory `includes/rss/extlib’

/usr/bin/install: omitting directory `includes/rss/htdocs’

/usr/bin/install: omitting directory `includes/rss/scripts’

make[1]: *** [install] Error 1

make[1]: Leaving directory `/home/ftladmin/Downloads/nagios/html’

make: *** [install] Error 2

root@FTLUBUNTU:~/Downloads/nagios# **

Here is the whole of the output from the make install command

**root@FTLUBUNTU:~/Downloads/nagios# make install

cd ./base && make install

make[1]: Entering directory `/home/ftladmin/Downloads/nagios/base’

make install-basic

make[2]: Entering directory `/home/ftladmin/Downloads/nagios/base’

/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/bin

/usr/bin/install -c -m 774 -o nagios -g nagios nagios /usr/local/nagios/bin

/usr/bin/install -c -m 774 -o nagios -g nagios nagiostats /usr/local/nagios/bin

make[2]: Leaving directory `/home/ftladmin/Downloads/nagios/base’

make strip-post-install

make[2]: Entering directory `/home/ftladmin/Downloads/nagios/base’

/usr/bin/strip /usr/local/nagios/bin/nagios

/usr/bin/strip /usr/local/nagios/bin/nagiostats

make[2]: Leaving directory `/home/ftladmin/Downloads/nagios/base’

make[1]: Leaving directory `/home/ftladmin/Downloads/nagios/base’

cd ./cgi && make install

make[1]: Entering directory `/home/ftladmin/Downloads/nagios/cgi’

make install-basic

make[2]: Entering directory `/home/ftladmin/Downloads/nagios/cgi’

/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/sbin
for file in *.cgi; do \

/usr/bin/install -c -m 775 -o nagios -g nagios $file /usr/local/nagios/sbin; \

done

make[2]: Leaving directory `/home/ftladmin/Downloads/nagios/cgi’

make strip-post-install

make[2]: Entering directory `/home/ftladmin/Downloads/nagios/cgi’

for file in *.cgi; do \

/usr/bin/strip /usr/local/nagios/sbin/$file; \

done

make[2]: Leaving directory `/home/ftladmin/Downloads/nagios/cgi’

make[1]: Leaving directory `/home/ftladmin/Downloads/nagios/cgi’

cd ./html && make install

make[1]: Entering directory `/home/ftladmin/Downloads/nagios/html’

/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share

/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/media

/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/stylesheets

/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/contexthelp

/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/docs

/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/docs/images

/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/images

/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/images/logos

/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/includes

/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/includes/rss

/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/includes/rss/extlib

/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/ssi

/usr/bin/install -c -m 664 -o nagios -g nagios robots.txt /usr/local/nagios/share

rm -f /usr/local/nagios/share/index.html

rm -f /usr/local/nagios/share/main.html

rm -f /usr/local/nagios/share/side.html

for file in *.php; \

do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share;
done

for file in stylesheets/*.css; \

do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/stylesheets;
done

for file in contexthelp/*.html; \

do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/contexthelp;
done

for file in images/*.gif; \

do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/images;
done

for file in images/*.jpg; \

do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/images;
done

for file in images/*.png; \

do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/images;
done

for file in images/*.ico;
do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/images;
done

for file in images/logos/.;
do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/images/logos;
done

for file in includes/.;
do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/includes;
done

for file in includes/rss/*;
do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/includes/rss;
done

/usr/bin/install: omitting directory `includes/rss/extlib’

/usr/bin/install: omitting directory `includes/rss/htdocs’

/usr/bin/install: omitting directory `includes/rss/scripts’

make[1]: *** [install] Error 1

make[1]: Leaving directory `/home/ftladmin/Downloads/nagios/html’

make: *** [install] Error 2

root@FTLUBUNTU:~/Downloads/nagios#**

Luca
(and any others that read this if they come accross the same issue)

This forum link worked for me

ubuntuforums.org/showthread.php?t=1814086

Ok so now i will progress with the install

aaaaaarrrrrrrrrrggggghhhhhhhhhhhhhhhhh

install completed.

Still the same error when in the web interface.

Thats 2 seperate guides i have followed and both result in the same outcome.

Again when i chmod 777 /usr/local/nagios/var/rw/nagios.cmd

Is there anyway i can permanently change these damn permissions on this file?

Thanks

Right i have solved the problem of the permissions error by adding

chmod 777 /usr/local/nagios/var/rw/nagios.cmd

To run at machine startup in

/etc/rc.local

No longer get the error now.

Easier way is to just change the permissions…

chown nagios.nagcmd /usr/local/nagios/var/rw
chmod g+rwx /usr/local/nagios/var/rw
chmod g+s /usr/local/nagios/var/rw
/etc/init.d/nagios restart

from http://www.telnetport25.com/2012/01/installing-nagios-on-ubuntu-server-11-10-then-monitoring-windows-and-exchange-serverspart-1configuring-ubuntu-for-the-installation-of-nagios-core

It’s also important to note that after adding apache to the nagcmd group, you should restart the httpd service as well.