Page 1 of 1

Dashboards still referring to old nagios server after backup

Posted: Wed Jan 30, 2019 3:01 am
by WillemDH
Hello,

We noticed that after a backup restore procedure (in order to migrate our CentOS 6 to CentOS 7), we are experiencing issues with dashboards. The ssl_error_log says:

Code: Select all

[Tue Jan 29 16:51:34.059550 2019] [:error] [pid 13410] [client 172.19.26.196:58225] PHP Fatal error:  Call to a member function xpath() on a non-object in /usr/local/nagiosxi/html/includes/components/graphexplorer/visFunctions.inc.php on line 601, referer: https://mynewnagiosserver.gentgrp.gent.be/nagiosxi/dashboards/dashboard.php?id=TIlKg0
[Tue Jan 29 16:56:33.869741 2019] [:error] [pid 13410] [client 172.19.26.196:58717] PHP Warning:  simplexml_load_file(): I/O warning : failed to load external entity "/usr/local/nagios/share/perfdata/myoldnagiosserver.gentgrp.gent.be/SRV_CPU_Stats.xml" in /usr/local/nagiosxi/html/includes/components/graphexplorer/visFunctions.inc.php on line 598, referer: https://mynewnagiosserver.gentgrp.gent.be/nagiosxi/dashboards/dashboard.php?id=TIlKg0
[Tue Jan 29 16:56:33.869779 2019] [:error] [pid 13410] [client 172.19.26.196:58717] PHP Fatal error:  Call to a member function xpath() on a non-object in /usr/local/nagiosxi/html/includes/components/graphexplorer/visFunctions.inc.php on line 601, referer: https://mynewnagiosserver.gentgrp.gent.be/nagiosxi/dashboards/dashboard.php?id=TIlKg0
[Tue Jan 29 17:01:33.867485 2019] [:error] [pid 15028] [client 172.19.26.196:59231] PHP Warning:  simplexml_load_file(): I/O warning : failed to load external entity "/usr/local/nagios/share/perfdata/myoldnagiosserver.gentgrp.gent.be/SRV_CPU_Stats.xml" in /usr/local/nagiosxi/html/includes/components/graphexplorer/visFunctions.inc.php on line 598, referer: https://mynewnagiosserver.gentgrp.gent.be/nagiosxi/dashboards/dashboard.php?id=TIlKg0
As you can see there are still references to 'myoldnagiosserver'.. How can we mass update the dashboards so the link to our new Nagios server name?

Grtz

Willem

Re: Dashboards still referring to old nagios server after ba

Posted: Wed Jan 30, 2019 11:24 am
by scottwilkerson
Do you know if your system is using postgresql database or are you only on mysql? you can check this with the following

Code: Select all

grep pgsql /usr/local/nagiosxi/html/config.inc.php

Re: Dashboards still referring to old nagios server after ba

Posted: Wed Jan 30, 2019 11:36 am
by scottwilkerson
Actually looking at this, it is trying to access a directory that contained your old server for performance data

Code: Select all

/usr/local/nagios/share/perfdata/myoldnagiosserver.gentgrp.gent.be/SRV_CPU_Stats.xml
I don't really know any way of changing this other than re-create the dashboard, or possibly symlink the directories

Re: Dashboards still referring to old nagios server after ba

Posted: Thu Jan 31, 2019 3:38 am
by WillemDH
Scott,

We migrated Postgres to Mysql on our old nagios server. After restoring a backup of our old Nagios server to a CentOS 7 Nagios server, all the home page custom url's still link the old server name. There must be a way to fix this with replacing the name of the old server with the name of the new server for all home pages of users?

Grtz

Willem

Re: Dashboards still referring to old nagios server after ba

Posted: Thu Jan 31, 2019 8:19 am
by scottwilkerson
Were they all set to the same thing in Admin -> Manage Components -> Home Page Modification -> Edit ? Or did users customize their own?

If they were you can change it there, if they customized their own they would each have to modify it.

I would try to give you SQL to change it if I could but unless myoldnagiosserver.gentgrp.gent.be has the exact char count as mynewnagiosserver.gentgrp.gent.be it would mess up the serialized array stored in the database.

Re: Dashboards still referring to old nagios server after ba

Posted: Thu Jan 31, 2019 5:20 pm
by SteveBeauchemin
Willem,

Been a while. I hope all is well with you and yours.

I have needed to make dashboard changes the hard way once before.
I found that is is saved in SQL and that the data can be changed but it is not simple.

The data is stored in the nagiosxi db. You can look at all of it, or look at just one user.
Using a single user id helps to narrow down the data while you figure out a solution.

Code: Select all

select * from xi_usermeta where keyname like 'dashboards';
or
select * from xi_usermeta where keyname = 'dashboards' and user_id = '65'
The way the data is stored is complicated, but you can figure it out.
The data has a number in front of the content that tells how many characters are used. For example:

Code: Select all

"a:34:{i:0;a:4:{s:2:"id";s:4:"home";s:5:"title";s:9:"Home Page";s:4:"opts";N;s:8:"dashlets";a:1:{i:0;a:5:{s:2:"id";s:8:"slmssvcc";s:4:"name";s:22:"xicore_getting_started";s:5:"title";s:15:"Getting Started";s:4:"opts";a:6:{s:6:"height";i:365;s:5:"width";i:41 (...)"
looking at a small piece - s:5:"title"
It tells you that the string has 5 characters.

So, to change your hostname - if the old and new have the same length, then you could theoretically do a simple search and replace in the DB field. If the name is longer or shorter, then you would also have to change the number in front of it.

So, get a DB person to spend some time and you can make a change without needing to manually recreate everything.

I have a methodology I use for Dashboard work. I use one Admin account as a Dashboard Developer. Another account as a Dashboard Deployer.
I am attaching my Doc for reference. I hope it helps. Having a specific process removes many headaches.

Good luck. Feel free to PM is you need to get deeper.

Steve B

Re: Dashboards still referring to old nagios server after ba

Posted: Thu Jan 31, 2019 5:39 pm
by scottwilkerson