odd permissions issue

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
benhank
Posts: 1264
Joined: Tue Apr 12, 2011 12:29 pm

odd permissions issue

Post 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.
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: odd permissions issue

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
benhank
Posts: 1264
Joined: Tue Apr 12, 2011 12:29 pm

Re: odd permissions issue

Post 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
You do not have the required permissions to view the files attached to this post.
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: odd permissions issue

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
benhank
Posts: 1264
Joined: Tue Apr 12, 2011 12:29 pm

Re: odd permissions issue

Post by benhank »

wait, you mean delete all my junk on my production machine?
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: odd permissions issue

Post 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.
Former Nagios employee
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: odd permissions issue

Post 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/
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
benhank
Posts: 1264
Joined: Tue Apr 12, 2011 12:29 pm

Re: odd permissions issue

Post by benhank »

I knew that just testin yah. you guys pass!
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: odd permissions issue

Post by lmiltchev »

Nice to hear back from you! You disappeared for a while from the forums, so we started to worry about you. :)
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
benhank
Posts: 1264
Joined: Tue Apr 12, 2011 12:29 pm

Re: odd permissions issue

Post by benhank »

yeah been setting up a logstash server.
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
Locked