Page 1 of 1
Copy Users, Settings and Passwords to new server
Posted: Fri Aug 05, 2016 2:28 am
by mido2010
Hi,
we are setting up a new Nagios XI Server because our old one became buggy. Everything went fine during migration but we are missing the User accounts that are normally configurable under Admin -> Manage users.
How can we copy the Users, their settings and passwords to the new machine?
Many thanks for any help in advance,
best regards,
Michael
Re: Copy Users, Settings and Passwords to new server
Posted: Fri Aug 05, 2016 11:10 am
by lmiltchev
I would guess you didn't restore from a backup but rather imported configs manually as you are missing the user data...
Are you using postgres or mysql on the old server? What about the new one? Run the following commands on both boxes, and show the output:
Code: Select all
echo '\d;' | psql nagiosxi nagiosxi
echo 'show databases;' | mysql -t -u root -pnagiosxi
How many users do you need to migrate?
Re: Copy Users, Settings and Passwords to new server
Posted: Mon Aug 08, 2016 1:50 am
by mido2010
Yes, that is right: to get an almost taintless new server we preferred just to import the config files, no backup has been restored.
Here is the output of the OLD server:
Code: Select all
[root@bs92 ~]# psql nagiosxi nagiosxi
psql (8.4.20)
Geben Sie »help« für Hilfe ein.
nagiosxi=> \d
Liste der Relationen
Schema | Name | Typ | Eigentümer
--------+-----------------------------+---------+------------
public | if_command_id_seq | Sequenz | nagiosxi
public | if_meta_id_seq | Sequenz | nagiosxi
public | if_option_id_seq | Sequenz | nagiosxi
public | if_sysstat_id_seq | Sequenz | nagiosxi
public | if_user_id_seq | Sequenz | nagiosxi
public | if_usermeta_id_seq | Sequenz | nagiosxi
public | xi_auditlog | Tabelle | nagiosxi
public | xi_auditlog_auditlog_id_seq | Sequenz | nagiosxi
public | xi_commands | Tabelle | nagiosxi
public | xi_commands_command_id_seq | Sequenz | nagiosxi
public | xi_events | Tabelle | nagiosxi
public | xi_events_event_id_seq | Sequenz | nagiosxi
public | xi_incidents | Tabelle | nagiosxi
public | xi_incidents_id_seq | Sequenz | nagiosxi
public | xi_meta | Tabelle | nagiosxi
public | xi_meta_meta_id_seq | Sequenz | nagiosxi
public | xi_options | Tabelle | nagiosxi
public | xi_options_option_id_seq | Sequenz | nagiosxi
public | xi_sysstat | Tabelle | nagiosxi
public | xi_sysstat_sysstat_id_seq | Sequenz | nagiosxi
public | xi_usermeta | Tabelle | nagiosxi
public | xi_usermeta_usermeta_id_seq | Sequenz | nagiosxi
public | xi_users | Tabelle | nagiosxi
public | xi_users_user_id_seq | Sequenz | nagiosxi
(24 Zeilen)
[root@bs92 ~]# mysql -t -u root -pnagiosxi
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 99982
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| nagios |
| nagiosql |
| test |
+--------------------+
5 rows in set (0.00 sec)
This is the output of the NEW server:
Code: Select all
[root@bs95 ~]# psql nagiosxi nagiosxi
psql: konnte nicht mit dem Server verbinden: Datei oder Verzeichnis nicht gefunden
Läuft der Server lokal und akzeptiert er Verbindungen
auf dem Unix-Domain-Socket »/tmp/.s.PGSQL.5432«?
[root@bs95 ~]#
[root@bs95 ~]# mysql -t -u root -pnagiosxi
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 126
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| nagios |
| nagiosql |
| nagiosxi |
| test |
+--------------------+
6 rows in set (0.01 sec)
mysql>
The output of the psql command on the new server means that there is no psql

Re: Copy Users, Settings and Passwords to new server
Posted: Mon Aug 08, 2016 10:32 am
by lmiltchev
Unfortunately, we don't have a "pg2mysql" script for migrating the data from postgres (from the old server) to the "nagiosxi" mysql database (to the new server).
Our developers are looking into creating such a script, but most probably it wouldn't be an automated procedure i.e. during an upgrade, but rather a manual process. The way I see it, you have two options:
1. Recreate all of the users manually
2. Backup your XI server, create snapshots if this is a VM, then try to migrate the data from postgres to mysql yourself. Here's a couple of links that can get you started.
https://github.com/ChrisLundquist/pg2mysql
http://stackoverflow.com/questions/1046 ... -dump-file
FYI, if you decide to take the second option, keep in mind that this is not going to be supported. We can try to help you, but we cannot guarantee that this is going to work, as this procedure has not been tested/documented.
Re: Copy Users, Settings and Passwords to new server
Posted: Tue Aug 09, 2016 12:41 am
by mido2010
OK, thanks for your help so far. We will migrate users manually.
Re: Copy Users, Settings and Passwords to new server
Posted: Tue Aug 09, 2016 9:19 am
by mcapra
Sorry we weren't able to be of more assistance! A postgresql to mysql script is something that quite a lot of people have requested.
Is it alright if we close this thread?