Out of sync databases after Configuration Snapshot Restore

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mingersoll
Posts: 3
Joined: Fri Dec 04, 2015 7:04 pm

Out of sync databases after Configuration Snapshot Restore

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

Re: Out of sync databases after Configuration Snapshot Resto

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
mingersoll
Posts: 3
Joined: Fri Dec 04, 2015 7:04 pm

Re: Out of sync databases after Configuration Snapshot Resto

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

Re: Out of sync databases after Configuration Snapshot Resto

Post by lmiltchev »

Is the issue resolved now?
Be sure to check out our Knowledgebase for helpful articles and solutions!
mingersoll
Posts: 3
Joined: Fri Dec 04, 2015 7:04 pm

Re: Out of sync databases after Configuration Snapshot Resto

Post 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.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Out of sync databases after Configuration Snapshot Resto

Post 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
Locked