Nagios.cmd is disapearing aftter restart nagios server

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
pjonkers
Posts: 3
Joined: Tue Apr 17, 2012 2:07 am

Nagios.cmd is disapearing aftter restart nagios server

Post 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
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Nagios.cmd is disapearing aftter restart nagios server

Post 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?
pjonkers
Posts: 3
Joined: Tue Apr 17, 2012 2:07 am

Re: Nagios.cmd is disapearing aftter restart nagios server

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios.cmd is disapearing aftter restart nagios server

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
pjonkers
Posts: 3
Joined: Tue Apr 17, 2012 2:07 am

Re: Nagios.cmd is disapearing aftter restart nagios server

Post 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
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Nagios.cmd is disapearing aftter restart nagios server

Post by agriffin »

You could add 'service nagios restart' to /etc/rc.local to start nagios twice when booting.
wormfishin
Posts: 31
Joined: Tue Apr 10, 2012 8:11 am

Re: Nagios.cmd is disapearing aftter restart nagios server

Post 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
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Nagios.cmd is disapearing aftter restart nagios server

Post by agriffin »

wormfishin wrote:You could call a script on startup:
That's essentially what happens when you add commands to /etc/rc.local.
Locked