Page 1 of 1

Nagios.cmd is disapearing aftter restart nagios server

Posted: Tue Apr 17, 2012 2:11 am
by pjonkers
I have a problem woth the Nagios.cmd file.

i am using nagios latest release en ubuntu latest release.
i have created the nagios.cmd with the following procedure

cd /usr/local/nagios/var/rw
touch nagios.cmd
chown nagios.www-data nagios.cmd
chmod 660 nagios.cmd

how can i resolve the issue that after every restart of the nagios server the file disapeares.
it only happend after a compleet restart of the servers.

cheers

Re: Nagios.cmd is disapearing aftter restart nagios server

Posted: Tue Apr 17, 2012 9:02 am
by agriffin
Nagios should be recreating that file every time it's restarted. Are you sure that Nagios has permission to write to that directory?

Re: Nagios.cmd is disapearing aftter restart nagios server

Posted: Tue Apr 17, 2012 9:50 am
by pjonkers
It seems Ok with the rights
When i recreate the file and stop en start nagios it works fine

It only occours when i restart the comPleet server

Is it a timing issua?

What should the rights be on the /usr/local/nagios/var/rw be ?

I am not a linux gooro so any help is welcome

Thx

Re: Nagios.cmd is disapearing aftter restart nagios server

Posted: Tue Apr 17, 2012 10:52 am
by scottwilkerson
pjonkers wrote:What should the rights be on the /usr/local/nagios/var/rw be ?

Code: Select all

# ls -ld /usr/local/nagios/var/rw
drwxrwsr-x 2 nagios nagcmd 4096 Apr 17 09:00 /usr/local/nagios/var/rw

Re: Nagios.cmd is disapearing aftter restart nagios server

Posted: Wed Apr 18, 2012 2:48 am
by pjonkers
I changed the rights for the RW folder as you specified and stil no luck.

but after teh reboot of the server.., i stopped nagios with /etc/init.d/nagios stop en started again with /etc/init.d/nagios start.
now the file is created.
is there a way to delay the nagios start command or do it twice ?

Peter

Re: Nagios.cmd is disapearing aftter restart nagios server

Posted: Wed Apr 18, 2012 2:00 pm
by agriffin
You could add 'service nagios restart' to /etc/rc.local to start nagios twice when booting.

Re: Nagios.cmd is disapearing aftter restart nagios server

Posted: Wed Apr 18, 2012 2:39 pm
by wormfishin
pjonkers wrote:I changed the rights for the RW folder as you specified and stil no luck.

but after teh reboot of the server.., i stopped nagios with /etc/init.d/nagios stop en started again with /etc/init.d/nagios start.
now the file is created.
is there a way to delay the nagios start command or do it twice ?

Peter
You could call a script on startup:

Code: Select all

#!/bin/bash
#how many seconds you want to delay for
sleep 300
#start nagios service
/sbin/service nagios start

Re: Nagios.cmd is disapearing aftter restart nagios server

Posted: Wed Apr 18, 2012 4:33 pm
by agriffin
wormfishin wrote:You could call a script on startup:
That's essentially what happens when you add commands to /etc/rc.local.