Page 1 of 1

Dump and import dashboards, etc. to failover

Posted: Thu Jan 28, 2021 6:23 pm
by gormank
Hi,
I dump the nagiosql DB and import it on the failover server as part of a cheap DR solution but I see dashboards aren't imported. I imagine there is more I need to do to to get my dashboards onto the DR host.

Can you provide info on what I need to do to get the dashboards from the primary to the failover host?

Thanks

Re: Dump and import dashboards, etc. to failover

Posted: Fri Jan 29, 2021 3:39 pm
by ssax
The only way this would work is if you did the same with the nagiosxi DB, there isn't currently a method to strip them out from one and put them into another system at this time unless you replace the entire nagiosxi DB which will overwrite your failover's XI settings with the production server's XI settings/users/etc, this is because the IDs in the data need to match and they won't unless they are the exact autoincrement/user ids that prod has.

Most just use the backup/restore functionality to make the failover system the same and then change Admin > Program URL after.

Re: Dump and import dashboards, etc. to failover

Posted: Fri Jan 29, 2021 4:58 pm
by gormank
I think I was doing a backup and restore in the past and it caused problems so I switched. I've been doing this for years w/o issues until I found the dashboards weren't being restored. Of course, the primaries have never failed and are only used during upgrades so far. Then again I do test periodically to make sure they're still working.

I want the users to be restored on the failover server because the people who manage users aren't able to remember to do so on both hosts in each env.

How can the program URL be changed or where is it stored? Obviously, it isn't practical to update it manually every 30 minutes when the restore is done.

What DB, schema, or whatever the term is are the dashboards stored in?

Re: Dump and import dashboards, etc. to failover

Posted: Mon Feb 01, 2021 5:51 pm
by ssax
They are stored in the xi_usermeta table in the nagiosxi DB:

Code: Select all

mysql -h 127.0.0.1 -uroot -pnagiosxi nagiosxi -e "select * from xi_usermeta where keyname like '%dashboards%';"
They are php serialized in case you want to review what they contain:

Code: Select all

https://www.unserialize.com/
You can update the Program URL like this:

Code: Select all

mysql -h 127.0.0.1 -uroot -pnagiosxi nagiosxi -e "update xi_options set value = 'http://yoururl/nagiosxi/' where name = 'url';"

Re: Dump and import dashboards, etc. to failover

Posted: Wed Mar 03, 2021 5:50 pm
by gormank
I copied a backup from the primary to the failover host, restored and verified the dashboards are now there. I'll update my script to copy a backup, restore and update the URL settings.
Feel free to close this.
Thanks!

Re: Dump and import dashboards, etc. to failover

Posted: Thu Mar 04, 2021 5:39 pm
by benjaminsmith
Hi @gormank

Great! We'll close this out.