Migrate from an EL-type OS to Debian
Prerequisites
This procedure only applies if the following conditions are met:
- You wish to migrate from a 64-bit EL-type OS to Debian. For instance, if you want to migrate from CentOS 7 to Debian 12.
- Your version of Centreon is 18.10 or newer and you wish to upgrade to the latest version of Centreon. If you wish to migrate from an older version, contact the Centreon support team.
All servers (central, remote and pollers) in your architecture must have the same major version of Centreon. It is also recommended that they have the same minor version.
If your Centreon platform includes a Centreon redundancy system, please contact Centreon support.
Migrating a platform
Step 1: Install the new central server
Install your new OS: check the supported operating systems.
Install a new Centreon central server from packages, until you complete the installation process by connecting to the Centreon web interface.
Use the same password for the centreon user as for the old platform during the web installation process.
Perform software and system updates:
apt update && apt upgrade
Step 2: Synchronize the data
Connect to your old Centreon server.
Generate a pair of ssh keys for root:
ssh-keygen -t rsa
By default, the key pair generated will be saved to /root/.ssh/id_rsa.pub and /root/.ssh/id_rsa.
Copy root's public key (/root/.ssh/id_rsa.pub) into the /root/.ssh/authorized_keys file of the new server. If you are not using root for the synchronization, make sure that the user you use has writing rights on the target directory.
From the old server, synchronize the following directories to the new server:
rsync -avz /etc/centreon root@<IP_NEW_CENTREON>:/etc
rsync -avz /etc/centreon-broker root@<IP_NEW_CENTREON>:/etc
rsync -avz /var/log/centreon-engine/archives/ root@<IP_NEW_CENTREON>:/var/log/centreon-engine
rsync -avz --exclude centcore/ --exclude log/ /var/lib/centreon root@<IP_NEW_CENTREON>:/var/lib
rsync -avz /usr/share/centreon/www/img/media root@<IP_NEW_CENTREON>:/usr/share/centreon/www/imgIf you have given a custom name to your private key file, use the following format (just replace id_rsa_custom with your file name, and
<command>
with the commands above):rsync -avz -e "ssh -i /root/.ssh/id_rsa_custom" <command>
Replace <IP_NEW_CENTREON> by the IP address of the new Centreon server.
On the new server, change the following user rights:
chown www-data: /etc/centreon-broker/*
chown www-data: /etc/centreon-engine/*
chown centreon: /etc/centreon/*
chown centreon: /var/lib/centreon/*
chown centreon-broker: /var/lib/centreon/metrics/*
chown centreon-broker: /var/lib/centreon/status/*
chown centreon-gorgone: /var/lib/centreon/nagios-perf/perfmon-* -R
chown centreon-engine: /var/lib/centreon/centplugins/*
Step 3: Retrieve the databases
On the old server, create a dump of the databases:
mysqldump -u root -p centreon > /tmp/centreon.sql
mysqldump -u root -p centreon_storage > /tmp/centreon_storage.sqlOn the old server, stop MariaDB:
systemctl stop mariadb
On the old server, export the dumps to the new Centreon database server (make sure you have enough space for large database dumps):
rsync -avz /tmp/centreon.sql root@<IP_NEW_CENTREON>:/tmp/
rsync -avz /tmp/centreon_storage.sql root@<IP_NEW_CENTREON>:/tmp/On the new database server, drop the original databases and create them again::
mysql -u root -p
DROP DATABASE centreon;
DROP DATABASE centreon_storage;
CREATE DATABASE centreon;
CREATE DATABASE centreon_storage;
exitOn the new database server, import the previously transferred dumps into the database:
mysql -u root centreon -p </tmp/centreon.sql
mysql -u root centreon_storage -p </tmp/centreon_storage.sqlUpgrade the tables:
mysql_upgrade
If your database is password-protected, enter:
mysql_upgrade -u <database_admin_user> -p
Example: if your database_admin_user is
root
, enter:mysql_upgrade -u root -p
Start the MariaDB process on the new server:
systemctl start mariadb
Replace <IP_NEW_CENTREON> by the IP address of the new Centreon server.
Step 4: Synchronize the plugins
If you only use Centreon plugins, reinstall them on the new server.
Install the Monitoring Connectors repository (you can find its address on the support portal).
Run the following commands:
apt update
apt install centreon-pack*
apt install centreon-plugin-\*
On Debian, the Nagios plugins directory (plugins that run commands like check_icmp) is /usr/lib/nagios/plugins/. Go to Configuration > Pollers > Resources and check that the path to the $USER1$ macro is /usr/lib/nagios/plugins/.
If you are using custom plugins, synchronize the directories that contain your custom plugins, including any necessary dependencies.
Step 5: Upgrade Centreon
On the new server, force the update by moving the contents of the /var/lib/centreon/installs/install-24.10.x-YYYYMMDD_HHMMSS directory to the /usr/share/centreon/www/install directory (x is the target version number for your migrated machine):
cd /var/lib/centreon/installs/
mv install-24.10.x-YYYYMMDD_HHMMSS/ /usr/share/centreon/www/install/If you use the same IP address or same DNS name on the old Centreon webserver and the new one, do a full cache cleanup of your browser to avoid JS issues.
Go to
http://<IP_NEW_CENTREON>/centreon
and perform the upgrade.If the password for user centreon that you specified when installing the new server is different from the password on the old server, you must follow these steps:
- Edit the /etc/centreon/centreon.conf.php file,
- Edit the /etc/centreon/conf.pm file,
- Edit the Centreon Broker central configuration using the Centreon web interface and change the password for the unfied-sql output,
- Edit the /etc/centreon/config.d/10-database.yaml file.
If the IP address of your Centreon server has changed:
- Edit the configuration for all the Centreon Broker modules of your Pollers and change the IP to connect to the Centreon Central server (output IPv4). See the Advanced configuration chapter for more information.
- The fingerprint of your platform has changed too: contact Centreon to obtain a new license.
The credentials of the newly created centreon-gorgone user need to be updated to match those of the centreon-gorgone user on the old server. Edit
etc/centreon-gorgone/config.d/31-centreon-api.yaml
and enter the credentials of the old user. Example:gorgone:
tpapi:
- name: centreonv2
base_url: "http://127.0.0.1/centreon/api/latest/"
username: "@GORGONE_USER@"
password: "@GORGONE_PASSWORD@"
- name: clapi
username: "@GORGONE_USER@"
password: "@GORGONE_PASSWORD@"Deploy the configuration for all your monitoring servers (including the central).
Restart the following processes:
systemctl restart cbd centengine
systemctl restart gorgoned
systemctl start snmptrapd centreontrapd
systemctl start snmpdIf your old Centreon server was monitoring itself, and you have changed the username/password for the database during the migration, update the configuration of all related resources (host, services attached to that host).
Go to Configuration > Monitoring Connector Manager, then update all the Monitoring Connectors.
Step 6 (older versions only): Migrate to Gorgone
If you are migrating from a Centreon version 18.10, 19.04 or 19.10, migrate from Centcore to Gorgone.
Step 7: Upgrade the modules
To upgrade the modules, go to Administration > Extensions > Manager and click Update all. If you have a MAP server or an MBI server, follow the corresponding migration procedures:
Step 8: Migrating your other servers (distributed architecture)
Migrating a remote server
To migrate a remote server:
- Follow the same procedure as for a central server.
- Attach the new remote server to your central server.
Migrating a poller
To migrate a poller:
- Install a new poller.
- Synchronize the plugins, as described in step 4 of the migration procedure for a central server.
- On the central server, go to Configuration > Pollers. Select the poller that was migrated and update its IP address (if it has changed).
- Deploy the configuration.
- If your poller does not work after migrating it (e.g. you cannot deploy the configuration or execute monitoring actions), update the poller's fingerprint, as described in this knowledge base article.