Page 1 of 1

Out of sync databases after Configuration Snapshot Restore

Posted: Thu Jan 18, 2018 4:30 pm
by mingersoll
When running a rollback via the configuration snapshot restore, the nagios and nagiosql databases get out of sync (see: https://support.nagios.com/kb/article/n ... t-407.html).

For example, the host below has 1 entry in the nagiosql.tbl_service table. But in the nagios.nagios_services table has more entries. In CCM, the 1 entry shows up when editing services for the host. Outside of CCM, the other services are still monitored and listed. The services config on the filesystem (/usr/local/nagios/etc/services/...) reflect that of nagios.nagios_services.

Code: Select all

MariaDB [nagiosql]> select name,active,config_name,host_name,service_description from tbl_service  where config_name like '%XYZ%';
+------+--------+----------------------------+-----------+---------------------------+
| name | active | config_name                | host_name | service_description       |
+------+--------+----------------------------+-----------+---------------------------+
|      | 1      | xyz....................... |         1 | example-description1..... |
+------+--------+----------------------------+-----------+---------------------------+
1 row in set (0.00 sec)

MariaDB [nagios]> select service_id, host_object_id, service_object_id, display_name from nagios_services where host_object_id=4757;
+------------+----------------+-------------------+---------------------------+
| service_id | host_object_id | service_object_id | display_name              |
+------------+----------------+-------------------+---------------------------+
|   11608837 |           4757 |              6395 | example-description1..... |
|   11608835 |           4757 |              5300 | xxa..................     |
|   11608836 |           4757 |              5301 | xxb..................     |
|   11608833 |           4757 |              5298 | xxc..................     |
|   11608834 |           4757 |              5299 | xxd..................     |
|   11608832 |           4757 |              5297 | xxe..................     |
|   11608831 |           4757 |              5296 | xxf..................     |
+------------+----------------+-------------------+---------------------------+
The current workaround I've used is to manually set the timestamp for out of sync hosts. Example:

Code: Select all

update tbl_service set last_modified=NOW() where id=123;
Then "apply configuration" in CCM and it will now be synced.

Is this expected behavior? Is there a way to force all configs to be redeployed to avoid anything else being out of sync?

Re: Out of sync databases after Configuration Snapshot Resto

Posted: Fri Jan 19, 2018 1:33 pm
by lmiltchev
Are the system and PHP time in sync on your system? Can you go to Admn > System Config > System Profile > View System Info, and show the "Date/Time" section? Also, run the following commands from the command line, and show the output in code wraps:

Code: Select all

date
echo 'select now();' | mysql -t -uroot -pnagiosxi
tail -100 /var/log/mariadb/mariadb.log

Re: Out of sync databases after Configuration Snapshot Resto

Posted: Mon Jan 22, 2018 4:31 pm
by mingersoll
lmiltchev wrote:Are the system and PHP time in sync on your system? Can you go to Admn > System Config > System Profile > View System Info, and show the "Date/Time" section? Also, run the following commands from the command line, and show the output in code wraps:

Code: Select all

date
echo 'select now();' | mysql -t -uroot -pnagiosxi
tail -100 /var/log/mariadb/mariadb.log
Thanks for the suggestion -- I had checked system vs php vs mysql date/times and they all match up.

Re: Out of sync databases after Configuration Snapshot Resto

Posted: Tue Jan 23, 2018 11:43 am
by lmiltchev
Is the issue resolved now?

Re: Out of sync databases after Configuration Snapshot Resto

Posted: Wed Jan 24, 2018 12:26 pm
by mingersoll
lmiltchev wrote:Is the issue resolved now?
Sorry, I wasn't clear before -- I had checked the date/time settings before posting here and the issue still exists.

Re: Out of sync databases after Configuration Snapshot Resto

Posted: Wed Jan 24, 2018 3:05 pm
by dwhitfield
Can you PM me your Profile? You can download it by going to Admin > System Config > System Profile and click the ***Download Profile*** button towards the top. If for whatever reason you *cannot* download the profile, please put the output of View System Info (5.3.4+, Show Profile if older) in the thread (that will at least get us some info). This will give us access to many of the logs we would otherwise ask for individually. If security is a concern, you can unzip the profile take out what you like, and then zip it up again. We may end up needing something you remove, but we can ask for that specifically.

You can also generate a profile manually using the script at /usr/local/nagiosxi/html/includes/components/profile/getprofile.sh

That should generate a profile in /usr/local/nagiosxi/var/components/ which you can get off the server with an application such as FileZilla.

After you PM the profile, please update this thread. Updating this thread is the only way for it to show back up on our dashboard.

If you get an error that PROFILE BUILD FAILED, please see https://support.nagios.com/kb/article.p ... ategory=44