files have incorrect permissions - but they are correct

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
seaward1983
Posts: 69
Joined: Wed Jul 17, 2019 2:09 pm

files have incorrect permissions - but they are correct

Post by seaward1983 »

Redhat 6
----

The following configuration files have incorrect permissions:

* /usr/local/nagios/etc/commands.cfg (OWNER=root, GROUP=root, PERMS=u---------)
* /usr/local/nagios/etc/contactgroups.cfg (OWNER=root, GROUP=root, PERMS=u---------)
* /usr/local/nagios/etc/contacts.cfg (OWNER=root, GROUP=root, PERMS=u---------)
* /usr/local/nagios/etc/contacttemplates.cfg (OWNER=root, GROUP=root, PERMS=u---------)
* /usr/local/nagios/etc/hostdependencies.cfg (OWNER=root, GROUP=root, PERMS=u---------)
* /usr/local/nagios/etc/hostescalations.cfg (OWNER=root, GROUP=root, PERMS=u---------)
* /usr/local/nagios/etc/hostextinfo.cfg (OWNER=root, GROUP=root, PERMS=u---------)
* /usr/local/nagios/etc/hostgroups.cfg (OWNER=root, GROUP=root, PERMS=u---------)
* /usr/local/nagios/etc/hosttemplates.cfg (OWNER=root, GROUP=root, PERMS=u---------)
* /usr/local/nagios/etc/servicedependencies.cfg (OWNER=root, GROUP=root, PERMS=u---------)
* /usr/local/nagios/etc/serviceescalations.cfg (OWNER=root, GROUP=root, PERMS=u---------)
* /usr/local/nagios/etc/serviceextinfo.cfg (OWNER=root, GROUP=root, PERMS=u---------)
* /usr/local/nagios/etc/servicegroups.cfg (OWNER=root, GROUP=root, PERMS=u---------)
* /usr/local/nagios/etc/servicetemplates.cfg (OWNER=root, GROUP=root, PERMS=u---------)
* /usr/local/nagios/etc/timeperiods.cfg (OWNER=root, GROUP=root, PERMS=u---------)

Each of these config files needs to be writable by the apache and nagios users. To fix this problem, follow these steps:

* Login to your Nagios XI server via SSH as the root user
* Execute the following commands:
o /usr/local/nagiosxi/scripts/reset_config_perms

-------------------------
On another post I saw this - but it didn't make a difference

chmod 664 /usr/local/nagios/etc/*.cfg
chown apache:nagios /usr/local/nagios/etc/*.cfg

-rw-rw-r-- 1 apache nagios 984 Jul 19 11:44 cgi.cfg
drwxrwxr-x 2 apache nagios 4096 Jul 18 09:55 hosts
drwxrwxr-x 2 apache nagios 4096 Jul 19 11:44 import
-rw-rw-r-- 1 apache nagios 5657 Jul 18 09:55 nagios.cfg
-rw-rw-r-- 1 apache nagios 2229 Jul 18 09:56 ndo2db.cfg
-rw-rw-r-- 1 apache nagios 4827 Jul 18 09:56 ndomod.cfg
-rw-rw-r-- 1 apache nagios 12455 Jul 18 09:56 nrpe.cfg
-rw-rw-r-- 1 apache nagios 5345 Jul 18 09:56 nsca.cfg
drwxrwxr-x 4 apache nagios 4096 Jul 18 09:56 pnp
-rw-rw-r-- 1 apache nagios 210 Jul 18 09:55 resource.cfg
-rw-rw-r-- 1 apache nagios 1627 Jul 18 09:56 send_nsca.cfg
drwxrwxr-x 2 apache nagios 4096 Jul 18 09:55 services
drwxrwxr-x 2 apache nagios 4096 Jul 18 09:55 static

-------------------
I tried to restart but get this when try to restart nagios service

Starting nagios:
Nagios Core 4.4.3
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2019-01-15
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Cannot open config file '/usr/local/nagios/etc/contacttemplates.cfg' for reading: No such file or directory
Error processing object config files!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: files have incorrect permissions - but they are correct

Post by lmiltchev »

What is the version of Nagios XI that you are currently using? Is this a fresh install or an upgrade? If it is an upgrade, what is the version of XI that you upgraded from? Is this a OVA, manual install/upgrade, RPM install/upgrade, online or offline?
Be sure to check out our Knowledgebase for helpful articles and solutions!
seaward1983
Posts: 69
Joined: Wed Jul 17, 2019 2:09 pm

Re: files have incorrect permissions - but they are correct

Post by seaward1983 »

This is a fresh install of XI. Offline install.

Your Nagios XI installation is up to date.
Latest Available Version: 5.6.4
Installed Version: 5.6.4
Last Update Check: 2019-07-18 10:34:42
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: files have incorrect permissions - but they are correct

Post by lmiltchev »

I performed an offline install of Nagios XI 5.6.4, and didn't have any permissions issues whatsoever... Have you tried modifying the default permissions on the system, e.g. hardening the server?

Go to the CCM > Tools > Config File Management, click on Write Configs then on Verify Files, and show the output after each click.

Also, PM me your latest profile (Admin > System Config > System Profile > Download Profile).
Be sure to check out our Knowledgebase for helpful articles and solutions!
seaward1983
Posts: 69
Joined: Wed Jul 17, 2019 2:09 pm

Re: files have incorrect permissions - but they are correct

Post by seaward1983 »

Well - that took care of THAT error - when I told it to restart Nagios core - I got this

Error: There are no services defined!
Error: There are no hosts defined!
Error: There are no contacts defined!
Error: Global host event handler command 'xi_host_event_handler' is not defined anywhere!
Error: Global service event handler command 'xi_service_event_handler' is not defined anywhere!

PMing you the profile now
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: files have incorrect permissions - but they are correct

Post by lmiltchev »

The profile that you sent me didn't have ANY configs in it... Looking at the errors below:
Error: There are no services defined!
Error: There are no hosts defined!
Error: There are no contacts defined!
Error: Global host event handler command 'xi_host_event_handler' is not defined anywhere!
Error: Global service event handler command 'xi_service_event_handler' is not defined anywhere!
I am beginning to think that you are missing all of these objects, and were never able to apply configuration even once. Did you delete localhost, contacts, and possibly other configs right after you installed Nagios XI?!

You could try the following in order to fix the issue:

1. Download Nagios XI 5.6.4 tarball from here:
https://assets.nagios.com/downloads/nag ... 6.4.tar.gz

2. Copy it over to the /tmp directory on the offline server, and untar it:

Code: Select all

cd /tmp
tar xvf xi-5.6.4.tar.gz
3. Copy some (or all of the configs in the following directories), depending on what you are missing to the import directory:

Code: Select all

cd /tmp/nagiosxi/subcomponents/nagioscore/mods/cfg/objects
cp ./* /usr/local/nagios/etc/import
cd /tmp/nagiosxi/subcomponents/nagioscore/mods/cfg/import
cp ./* /usr/local/nagios/etc/import
4. Run reconfigure_nagios.sh script to import the configs:

Code: Select all

/usr/local/nagiosxi/scripts/reconfigure_nagios.sh
Note: Another option would be to start from scratch and do a new, fresh install of Nagios XI.
Be sure to check out our Knowledgebase for helpful articles and solutions!
seaward1983
Posts: 69
Joined: Wed Jul 17, 2019 2:09 pm

Re: files have incorrect permissions - but they are correct

Post by seaward1983 »

That took care of that! Thanks.
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: files have incorrect permissions - but they are correct

Post by mbellerue »

Glad to hear everything is working!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked