Page 1 of 1

Apply Configuration wipes out services.

Posted: Mon Nov 15, 2021 6:37 pm
by scookpfs
Hello

When we try to Apply Configiuration it fails saying there are 0 services, and it restores the config.

When doing a Delete Files, Write Configs, Verify Files no services are written to /usr/local/nagios/etc/services/

Doing a Verify Config on the good config shows plenty of services (ignore the censored warnings, they're not the issue and contain customer names)
verify_before.png

A "Delete All Hosts/Services Configuration Files" and then "Write Configs" works without errors.
Write configs.png
Then running "Verify Config" shows 0 services.
Verify_after.png
Looking at the CCM it shows services (there are some disabled, but only a few).
ccm.PNG
So we're currently unable to make changes through the interface, and I'm holding off putting new changes into static.


We have recenty migrated the server from CentOS 6 to 7, and this is XI v 5.2.0 so we were going to upgrade, but this is holding us back.

Thanks

Re: Apply Configuration wipes out services.

Posted: Tue Nov 16, 2021 10:13 am
by scookpfs
I've solved the problem, it was a setting in the MySQL config.

I ran the SQL used for exporting the CCM Services config from the database, and saw it was giving an error

Code: Select all

mysql> SELECT `id`, `config_name` FROM (SELECT `id`, `config_name`, `last_modified` FROM `tbl_service` WHERE `config_id` = '1' AND `active`='1' ORDER BY `last_modified` DESC) as `X` GROUP BY HEX(`config_name`);
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'X.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
I googled "this is incompatible with sql_mode=only_full_group_by" and it relates to a strict mysql setting
So, I've added the following to the /etc/my.cnf file (I did fully test my test VM clone instance)

Code: Select all

sql_mode="ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
And it works.

Re: Apply Configuration wipes out services.

Posted: Tue Nov 16, 2021 10:25 am
by gsmith
Hi

Glad you were able to get it working. We actually have people set it as:

Code: Select all

[mysqld]
sql_mode=""
This is documented in:
https://support.nagios.com/kb/article/n ... n-822.html

I am going to lock this but please feel free to reopen it.

Thanks