Migrating from a standard realm to an observability realm
The operational steps required to migrate a standard Reino instance to Elasticsearch 9 are described below. The process involves configuring Aggregator, copying auxiliary files, migrating reports and running the relevant migration scripts.
Reference variables
The following placeholders are used throughout this guide:
Placeholder |
Description |
|---|---|
[realm] |
Name of the realm to be migrated. |
[user] |
A user with SSH access to the source environment. |
[files_to_copy] |
Specific files or directories that need to be copied. |
[type_of_realm] |
Type of realm used in Aggregator. |
[output_file] |
File generated during export. |
[id_new_realm] |
Identifier for the new realm in the destination aggregator. |
Note
Before executing any command, check the actual names of the realm, paths, containers and files in the relevant environment.
Migration of MIBs from Import-tool
Copy the MIB directories from the source environment to the backend container of the target Kingdom.
bash
scp -r [user]@[nombre_de_reino]:/opt/wocu/embedded/wocu/wocu-import-tool/wocu-import-tool/snmp_traps/mibs/ /root/
docker cp /root/mibs/. wocu_[nombre_de_reino]-backend-1:/mibs/
Migrating Shinken configuration files
If the environment contains Shinken .cfg files, these should be copied in a similar way to the previous case.
bash
scp -r [user]@[nombre_de_reino]:/var/opt/wocu/etc/shinken/[archivos_a_copiar] ./
docker cp ./[archivos_a_copiar] wocu_[nombre_de_reino]-backend-1:/etc/shinken/
Attention
In Configuration > Tasks, the task Cache Forecast Values appears, although it should not be displayed.
Migration of CSV import tasks
The CSV import tasks use files stored in /tmp/supervision/. These files must be copied to the backend’s Docker container.
bash
scp -r [user]@[nombre_de_reino]:/tmp/supervision/[archivos_a_copiar] ./
docker cp ./[archivos_a_copiar] wocu_[nombre_de_reino]-backend-1:/tmp/supervision/
Snapshot migration
Copy the JSON files from the source environment:
[nombre_de_reino]:/var/opt/wocu/var/backups/import-tool
Change the variables
ENCRYPT_SALTandSECRET_KEY.If applicable, remove these variables from the
docker-compose.ymlfile.
Report migration
This procedure will be necessary when reports need to be migrated from one aggregator to another.
Export in the source aggregator
bash
cd /opt/wocu/embedded/wocu/wocu-aggregator/wocu-aggregator/
/opt/wocu/embedded/bin/python3 ./manage.py export_realm_reports [nombre_de_reino] --realm-type [tipo_de_reino] --output [archivo_de_salida] --pretty
Import into the destination aggregator
bash
/opt/wocu/embedded/bin/python3 ./manage.py import_realm_reports [archivo_de_salida] --object-id [id_nuevo_reino]
Copies of cover images
Copy the cover files associated with the news reports.
Environment |
Path |
|---|---|
Origin |
/var/opt/wocu/var/aggregator/media/report_news/cover_images/* |
Destination |
/var/opt/wocu/var/aggregator/media/report_news/cover_images/ |
Migrating from MongoDB to Elasticsearch 9
Amend the MongoDB connection variables in the script, such as the database name.
Amend the Elasticsearch connection variables in the script, such as the destination.
Run the following migration script:
bash
/opt/wocu/embedded/bin/python3 mongo_to_elastic.py
Configuring the API key for Elasticsearch
The script was modified to use API key authentication:
es = Elasticsearch(
ELASTIC_URL,
headers={"Authorization": f"ApiKey {ELASTIC_API_KEY}"},
)
Migrating from InfluxDB to Elasticsearch 9
Amend the InfluxDB connection variables in the script, such as the source.
Amend the Elasticsearch connection variables in the script, such as the destination.
Run the following migration script:
bash
/opt/wocu/embedded/bin/python3 influx_to_elastic.py
Recommendation
Check that the hostgroups key exists before deleting it to avoid a KeyError.
For example: linea_json.pop("hostgroups", None)
Validation checklist
Before finalising the migration, please check that the following tasks have been completed correctly:
Kingdom Settings
✔ The Kingdom is available on Aggregator.
✔ The Elasticsearch backend is configured.
✔ The API key has the minimum necessary permissions.
✔ The Kibana spaces have been configured correctly.
Files and auxiliary settings
✔ The MIBs have been copied to the backend container.
✔ The Shinken
.cfgfiles have been migrated, where applicable.✔ The CSV files in
/tmp/supervision/have been copied to the container.✔ The JSON snapshots have been transferred successfully.
✔ The variables
ENCRYPT_SALTandSECRET_KEYhave been reviewed and adjusted.
Reports and related content
✔ The reports have been exported and imported successfully.
✔ The cover images associated with the reports have been copied to the destination environment.
Data migration
✔ The migration from MongoDB to Elasticsearch 9 has been carried out or validated.
✔ The migration from InfluxDB to Elasticsearch 9 has been carried out or validated.