Page 2 of 2

Re: Have to delete and write config files after every change

Posted: Thu Jan 03, 2019 2:33 pm
by hbouma
Output (Server names replaced in the duplicates)

Code: Select all

$ ./reconfigure_nagios.sh

--- reset_config_perms.sh ------------
> Setting CCM script permissions
> Setting script permissions
> Setting special component script permissions
> Setting configuration file/directory permissions
> Setting perfdata directory and RRD permissions
> Setting NOM checkpoint user:group permissions
> + Setting CCM configuration file user:group permissions
> + Setting Recurring Downtime file user:group permissions
> + Setting BPI configuration file user:group permissions
--------------------------------------

--- ccm_import.php -------------------
> Setting import directory: /usr/local/nagios/etc/import/
> Importing config files into the CCM
  No files to import
--------------------------------------

--- ccm_export.php -------------------
> Writing CCM configuration to Nagios files
  Finished writing out configuraton
--------------------------------------

--------------------------------------
> Verifying configuration with Nagios Core
> Output:
Nagios Core 4.4.2
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2018-08-16
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
Warning: Duplicate definition found for service 'Disk Usage on C:/' on host 'SERVER1' (config file '/usr/local/nagios/etc/services/SERVER3.cfg', starting on line 48)
Warning: Duplicate definition found for service 'Disk Usage on C:/' on host 'SERVER1' (config file '/usr/local/nagios/etc/services/SERVER1.cfg', starting on line 48)
Warning: Duplicate definition found for service 'Disk Usage on C:/' on host 'SERVER2' (config file '/usr/local/nagios/etc/services/SERVER3.cfg', starting on line 48)
Warning: Duplicate definition found for service 'Disk Usage on C:/' on host 'SERVER2' (config file '/usr/local/nagios/etc/services/SERVER3.cfg', starting on line 48)
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
        Checked 6227 services.
        Checked 270 hosts.
        Checked 146 host groups.
        Checked 80 service groups.
        Checked 302 contacts.
        Checked 98 contact groups.
        Checked 142 commands.
        Checked 312 time periods.
        Checked 0 host escalations.
        Checked 0 service escalations.
Checking for circular paths...
        Checked 270 hosts
        Checked 0 service dependencies
        Checked 0 host dependencies
        Checked 312 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check
> Return Code: 0
--------------------------------------
The odd thing is that the duplicate lines don't actually exist in the config files for SERVER3.

Re: Have to delete and write config files after every change

Posted: Thu Jan 03, 2019 3:27 pm
by npolovenko
@hbouma, Please run the repair databases script and let me know if it fixes your issue.
/usr/local/nagiosxi/scripts/repair_databases.sh
Next, please show me the output of the following commands:
cat /etc/rc.d/init.d/nagios | grep NagiosRunFile=
cat /usr/local/nagiosxi/scripts/nom_restore_nagioscore_checkpoint.sh | grep lockfile=
cat /usr/local/nagiosxi/scripts/nom_restore_nagioscore_checkpoint_specific.sh | grep lockfile=
cat /usr/local/nagios/etc/nagios.cfg | grep lock
Finally, please run these commands if you are on CentOS/RHEL 6.X:
service crond stop
service npcd stop
service nagios stop
service ndo2db stop
pkill -9 -u nagios
for i in $(ipcs -q | grep nagios |awk '{print $2}'); do ipcrm -q $i; done
rm -rf /usr/local/nagiosxi/var/dbmaint.lock
rm -rf /usr/local/nagiosxi/var/event_handler.lock
rm -rf /usr/local/nagiosxi/scripts/reconfigure_nagios.lock
service mysqld restart
service ndo2db start
service nagios start
service npcd start
service crond start
Or run these commands if you are on CentOS/RHEL 7.X:
systemctl stop crond
systemctl stop npcd
systemctl stop nagios
systemctl stop ndo2db
pkill -9 -u nagios
for i in $(ipcs -q | grep nagios |awk '{print $2}'); do ipcrm -q $i; done
rm -rf /usr/local/nagiosxi/var/dbmaint.lock
rm -rf /usr/local/nagiosxi/var/event_handler.lock
rm -rf /usr/local/nagiosxi/scripts/reconfigure_nagios.lock
systemctl restart mariadb
systemctl start ndo2db
systemctl start nagios
systemctl start npcd
systemctl start crond

Re: Have to delete and write config files after every change

Posted: Thu Jan 03, 2019 3:38 pm
by hbouma
/usr/local/nagiosxi/scripts/repair_databases.sh
Completed without errors. This did not resolve the issue.

Code: Select all

$ cat /etc/rc.d/init.d/nagios | grep NagiosRunFile=
NagiosRunFile=/var/run/nagios.lock

Code: Select all

$ cat /usr/local/nagiosxi/scripts/nom_restore_nagioscore_checkpoint.sh | grep lockfile=
lockfile="/var/run/nagios.lock"

Code: Select all

$ cat /usr/local/nagiosxi/scripts/nom_restore_nagioscore_checkpoint.sh | grep lockfile=
lockfile="/var/run/nagios.lock"

Code: Select all

$ cat /usr/local/nagios/etc/nagios.cfg | grep lock
lock_file=/var/run/nagios.lock
As for running those commands on our RHEL 7 box, I have a change request in, but it will take 1 week for our lower environment and 2 weeks for our Production environment.

Re: Have to delete and write config files after every change

Posted: Thu Jan 03, 2019 4:23 pm
by npolovenko
@hbouma, Can you check into MySQL logs on remote servers?
10.201.252.17
10.201.252.27
10.201.252.12
10.201.252.24
The db log should be in one of these locations:
/var/log/mariadb/mariadb.log
or
/var/log/mysqld.log
If you see any errors please post them in the thread.

Re: Have to delete and write config files after every change

Posted: Thu Jan 03, 2019 4:27 pm
by hbouma
They all have the same messages in /var/log/mariadb/mariadb.log.

181210 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181210 12:32:27 [ERROR] Invalid (old?) table or database name 'lost+found'
181211 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181212 5:00:02 [ERROR] Invalid (old?) table or database name 'lost+found'
181213 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181214 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181215 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181216 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181217 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181218 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181219 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181220 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181221 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181222 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181223 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181224 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181225 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181226 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181227 5:00:02 [ERROR] Invalid (old?) table or database name 'lost+found'
181228 5:00:02 [ERROR] Invalid (old?) table or database name 'lost+found'
181229 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181230 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
181231 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
190101 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
190102 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'
190103 5:00:01 [ERROR] Invalid (old?) table or database name 'lost+found'

Re: Have to delete and write config files after every change

Posted: Thu Jan 03, 2019 5:09 pm
by npolovenko
@hbouma, These messages don't seem to be related to the issue. Can you change some host or service config again and then run the following command in console and while it's still running go ahead and click on Apply Configuration:
tail -f /usr/local/nagiosxi/var/cmdsubsys.log
Please paste all the output from the command in the thread.

Next, sign in to the core interface:
*Replace 192.168.3.144 with your XI IP address.

And let me know whether the service that you just changed is displayed with the right changes or displayed as if you haven't made any changes.

Re: Have to delete and write config files after every change

Posted: Fri Jan 04, 2019 10:40 am
by hbouma
Here is what happens. The service I deleted is showing in both Nagios Core and Nagios XI still after applying the configuration.

Code: Select all

OUTPUT=--------------------------------------
RETURNCODE=0
PROCESSING COMMAND ID 637...
PROCESS COMMAND: CMD=1150, DATA=remove
CMDLINE=php /usr/local/nagiosxi/html/includes/components/nagiosbpi/api_tool.php --cmd=syncall
CMD: syncall
MSG: BPI configuration applied successfully! BPI configuration applied successfully!
OUTPUT=MSG: BPI configuration applied successfully! BPI configuration applied successfully!
RETURNCODE=0
..............PROCESSING COMMAND ID 638...
PROCESS COMMAND: CMD=17, DATA=
APPLYING NAGIOSCORE CONFIG...
CMDLINE=cd /usr/local/nagiosxi/scripts && ./reconfigure_nagios.sh
No entry for terminal type "unknown";
using dumb terminal settings.

--- reset_config_perms.sh ------------
> Setting CCM script permissions
> Setting script permissions
> Setting special component script permissions
> Setting configuration file/directory permissions
> Setting perfdata directory and RRD permissions
> Setting NOM checkpoint user:group permissions
> + Setting CCM configuration file user:group permissions
> + Setting Recurring Downtime file user:group permissions
> + Setting BPI configuration file user:group permissions
--------------------------------------

--- ccm_import.php -------------------
> Setting import directory: /usr/local/nagios/etc/import/
> Importing config files into the CCM
  No files to import
--------------------------------------

--- ccm_export.php -------------------
> Writing CCM configuration to Nagios files
  Finished writing out configuraton
--------------------------------------

--------------------------------------
> Verifying configuration with Nagios Core
> Output:
Nagios Core 4.4.2
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2018-08-16
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
        Checked 6002 services.
Warning: Host 'localhost' has no default contacts or contactgroups defined!
        Checked 283 hosts.
        Checked 49 host groups.
        Checked 82 service groups.
        Checked 304 contacts.
        Checked 98 contact groups.
        Checked 147 commands.
        Checked 311 time periods.
        Checked 0 host escalations.
        Checked 0 service escalations.
Checking for circular paths...
        Checked 283 hosts
        Checked 0 service dependencies
        Checked 0 host dependencies
        Checked 311 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 1
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check
> Return Code: 0
--------------------------------------
OUTPUT=--------------------------------------
RETURNCODE=0
PROCESSING COMMAND ID 639...
PROCESS COMMAND: CMD=1150, DATA=remove
CMDLINE=php /usr/local/nagiosxi/html/includes/components/nagiosbpi/api_tool.php --cmd=syncall
CMD: syncall
MSG: BPI configuration applied successfully! BPI configuration applied successfully!
OUTPUT=MSG: BPI configuration applied successfully! BPI configuration applied successfully!
RETURNCODE=0
......
PROCESSED 6 COMMANDS
...........................................................
PROCESSED 0 COMMANDS
.............................................................
PROCESSED 0 COMMANDS

Re: Have to delete and write config files after every change

Posted: Fri Jan 04, 2019 12:31 pm
by npolovenko
@hbouma, I would like to do a remote session if possible. Would you be able to open a support ticket with us and reference this forum thread?
https://support.nagios.com/tickets

Re: Have to delete and write config files after every change

Posted: Mon Jan 07, 2019 10:07 am
by hbouma
Ticket opened.

Re: Have to delete and write config files after every change

Posted: Mon Jan 07, 2019 11:56 am
by ssax
Locking thread, ticket received, we will continue support through the ticket.