Page 1 of 2

odd permissions issue

Posted: Thu Aug 07, 2014 11:46 am
by benhank
hello guys,

We are having an issue in which we can successfuly do an aply cfg,but the changes dont stick.
when we use write config there is an error saying cannot open the hosts and services directories.
the two dirs perms are both 6775 and the files are 0644.
we have run fix permissions and what not.

Re: odd permissions issue

Posted: Thu Aug 07, 2014 11:50 am
by abrist
Ben,
What is the error verbatim?
What are the permissions on the following directories:

Code: Select all

ls -lad /usr/local/nagios
ls -lad /usr/local/nagios/etc
ls -lad /usr/local/nagios/hosts
ls -lad /usr/local/nagios/services
Is your nagios account still valid?

Code: Select all

chage -l nagios

Re: odd permissions issue

Posted: Thu Aug 07, 2014 4:04 pm
by benhank
'ere yah go mon:

Code: Select all

Write host configurations ...
Cannot open/overwrite the host configuration files (check the permissions)!
Write service configurations ...
Cannot open/overwrite service configuration files (check the permissions)!
Configuration file: hostgroups.cfg successfully written!
Configuration file: servicegroups.cfg successfully written!
Configuration file: hosttemplates.cfg successfully written!
Configuration file: servicetemplates.cfg successfully written!
Configuration file: timeperiods.cfg successfully written!
Configuration file: commands.cfg successfully written!
Configuration file: contacts.cfg successfully written!
Configuration file: contactgroups.cfg successfully written!
Configuration file: contacttemplates.cfg successfully written!
Configuration file: servicedependencies.cfg successfully written!
Configuration file: hostdependencies.cfg successfully written!
Configuration file: serviceescalations.cfg successfully written!
Configuration file: hostescalations.cfg successfully written!
Configuration file: serviceextinfo.cfg successfully written!
Configuration file: hostextinfo.cfg successfully written!
text.png

Re: odd permissions issue

Posted: Thu Aug 07, 2014 4:45 pm
by abrist
Ben,
Lets try to remove all the host and service files, and rewrite them (this may take 5-10 minutes!):

Code: Select all

rm -f /usr/local/nagios/etc/hosts/*
rm -f /usr/local/nagios/etc/services/*
No go to Configure --> CCM --> Tools --> Write config files. Click write, and then verify. if all is well, try to apply config again.

Re: odd permissions issue

Posted: Fri Aug 08, 2014 10:57 am
by benhank
wait, you mean delete all my junk on my production machine?

Re: odd permissions issue

Posted: Fri Aug 08, 2014 11:19 am
by tmcdonald
You can back it up instead of deleting it, but yes that is the fix. The CCM -> Tools -> Write button will re-write all of the configs just like an Apply Config does, and the verify will run "nagios -v" against them to check for any warnings/errors in the configs.

Re: odd permissions issue

Posted: Fri Aug 08, 2014 11:20 am
by lmiltchev
Yes, that's what Andy meant. :)

When you apply configuration, the files will be rewritten.

If it makes you feel safer, you can move all of the configs from "hosts" and "services" directories to "/tmp/" instead of deleting them.

Code: Select all

cd /tmp
mkdir hosts services
mv /usr/local/nagios/etc/hosts/* /tmp/hosts/
mv /usr/local/nagios/etc/services/* /tmp/services/

Re: odd permissions issue

Posted: Fri Aug 08, 2014 11:25 am
by benhank
I knew that just testin yah. you guys pass!

Re: odd permissions issue

Posted: Fri Aug 08, 2014 11:33 am
by lmiltchev
Nice to hear back from you! You disappeared for a while from the forums, so we started to worry about you. :)

Re: odd permissions issue

Posted: Fri Aug 08, 2014 11:41 am
by benhank
yeah been setting up a logstash server.