QUESTION:
How do I move devices from one DGEx to another DGEx?
SOLUTION:
Expectations
- These instructions can be applied to a target DGE-X that is new or already contains existing monitored devices with historical data
- If the target DGE-X is reporting under the same upstream DGE as the source DGE-X, historical (aggregated) data will be retained (data will already exists under the same upstream)
- If target DGE-X will be reporting under a different upstream DGE than the source DGE-X and the upstream DGE is completely new, you may be able to retain history/data of the moved device(s) by instead following (remembering to specify DGEX name for target and source): https://kaseya.zendesk.com/entries/85850016-Migrating-Moving-Devices-From-an-Old-DGE-to-a-New-DGE
- Source DGE-X and target DGE-X are running similar OS type (e.g. Windows vs Linux)
- During the actual move, source DGE-X and target DGE-X components will need to be offline
- BVE needs the 'Provisioning Database' and 'BVE API' components running
- If dependencies need to be retained, exportAndDeleteDependency.pl and importAndCrateDependency.pl to be placed under \plugin\utils on the BVE (download attached migrations-tools.zip)
Before migrating, we suggest you review the steps below and have attempted on a test environment if possible. In order to move devices from a source DGE-X to a target DGE-X, you may use individual device names or you may use wildcards on the device name. It is strongly recommended that you create a backup of the provisioning database on the BVE and (at least) the "database" directory on the source/target DGEs in case you need to rollback the changes.
Device list preparation
Should you need to move devices by individual device names, you can start by creating a list of devices that to be migrated. If you do not have a list of devices handy, you may create one by following these steps:
- On BVE (make sure the BVE API component is running)
- Create an empty file named devicelist.txt file and add the following line: device.list "devicename=*"
- From command line: utils\bveCLI.pl --host localhost --username=superuser --password=SUPERUSERPASSWORD --input=devicelist.txt 'devicename=*' --format=csv --fields=devicename,dgename --output devicelist.csv
"SUPERUSERPASSWORD" will of course need to be changed to the correct password associated with the superuser account. This command will output all devices provisioned in Traverse, redirected into devicelist.csv. You should be able to open this file with an Excel spreadsheet and sort by the dgename column and delete the unwanted devices (rows) so you are left with only the desired devices from the desired DGE.
Migration Steps (commands are run from <TRAVERSE_HOME> on BVE)
- Backup your BVE and upstream DGE databases: On BVE and upstream DGE run: utils\db_backup.cmd (Windows) or utils/db_backup.sh (Linux)
- Stop all Traverse components on source DGE-X and target DGE-X
-
If the target DGE-X will have a different upstream DGE
- Stop all Traverse components on the source's upstream DGE and the target's upstream DGE.
-
Else (i.e. source and target share upstream DGE)
- Components can remain running on the upstream DGE
- Please make sure the following components are running on the BVE: "Provisioning Database" and "BVE API"
- Export device dependencies: (This entire step can be skipped if there are no device dependencies or you do not wish to retain device dependencies)
Note: device parameter can be a wildcard of the devicename (only '*' is supported) otherwise each device can be defined individually
From <TRAVERSE_HOME>, where --user is the department level user and --pass is the corresponding password and --device is the device name or a valid device name wildcard string:
(Windows)
Wildcard examples:
plugin\utils\exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "ABACABA*" >> c:\temp\list1.csv
plugin\utils\exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "CDCABA*" >> c:\temp\list1.csv
plugin\utils\exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "CA*" >> c:\temp\list1.csv
Individual device examples:
plugin\utils\exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "DEVICE1" >> c:\temp\list1.csv
plugin\utils\exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "DEVICE2" >> c:\temp\list1.csv
plugin\utils\exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "DEVICE3" >> c:\temp\list1.csv
(Linux)
Wildcard examples:
plugin/utils/exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "ABACABA*" >> /root/temp/list1.csv
plugin/utils/exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "CDCABA*" >> /root/temp/list1.csv
plugin/utils/exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "CA*" >> /root/temp/list1.csv
Individual device examples:
plugin/utils/exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "DEVICE1" >> /tmp/list1.csv
plugin/utils/exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "DEVICE2" >> /tmp/list1.csv
plugin/utils/exportAndDeleteDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --device "DEVICE3" >> /tmp/list1.csv
- Move the devices from source DGE-X to target DGE-X
Please take note:
- The use of the wildcard symbol "*" below, cannot be used on its own to move all the devices at once. It needs to be combined with a valid character(s) to work. e.g. ABC*, *A, etc.
(Windows)
Wildcard examples:
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -Djava.ext.dirs=webapp\WEB-INF\lib com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGEXNAME" "targetDGEXNAME" "ABACABA*"
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -Djava.ext.dirs=webapp\WEB-INF\lib com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGEXNAME" "targetDGEXNAME" "CDCABA*"
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -Djava.ext.dirs=webapp\WEB-INF\lib com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGEXNAME" "targetDGEXNAME" "CA*"
Individual device examples:
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -Djava.ext.dirs=webapp\WEB-INF\lib com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGEXNAME" "targetDGEXNAME" "DEVICE1"
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -Djava.ext.dirs=webapp\WEB-INF\lib com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGEXNAME" "targetDGEXNAME" "DEVICE2"
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -Djava.ext.dirs=webapp\WEB-INF\lib com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGEXNAME" "targetDGEXNAME" "DEVICE3"
If Your Traverse is 9.6.15 [ windows ] or later release, please follow the below commands
Wildcard examples:
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -cp "webapp\WEB-INF\lib\*" com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGEXNAME" "targetDGEXNAME" "ABACABA*"
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -cp "webapp\WEB-INF\lib\*" com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGEXNAME" "targetDGEXNAME" "CDCABA*"
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -cp "webapp\WEB-INF\lib\*" com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGEXNAME" "targetDGEXNAME" "CA*"
Individual device examples:
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -cp "webapp\WEB-INF\lib\*" com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGEXNAME" "targetDGEXNAME" "DEVICE1"
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -cp "webapp\WEB-INF\lib\*" com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGEXNAME" "targetDGEXNAME" "DEVICE2"
apps\jre\bin\java -Xmx1024m -noverify -Dnetvigil.config="%CD%\etc\emerald.properties" -Dlog4j.configuration="file:///%CD%\etc\log4j.conf" -cp "webapp\WEB-INF\lib\*" com.zyrion.traverse.utils.MoveDevices "%CD%\etc\emerald.xml" "sourceDGEXNAME" "targetDGEXNAME" "DEVICE3"
(Linux)
- Update and save the moveDevices.sh script
<traverse_home>/database/schema/alter/moveDevices.sh
from:
49 $JAVA_HOME/bin/java -Xmx256m $CVPARAM \
to:
49 $JAVA_HOME/bin/java -Xmx1024m $CVPARAM \
Wildcard examples:
database/schema/alter/moveDevices.sh 'sourceDGEXNAME' 'targetDGEXNAME' 'ABACABA*' database/schema/alter/moveDevices.sh 'sourceDGEXNAME' 'targetDGEXNAME' 'CDCABA*' database/schema/alter/moveDevices.sh 'sourceDGEXNAME' 'targetDGEXNAME' 'CA*'
Individual device examples:
database/schema/alter/moveDevices.sh 'sourceDGEXNAME' 'targetDGEXNAME' 'DEVICE1' database/schema/alter/moveDevices.sh 'sourceDGEXNAME' 'targetDGEXNAME' 'DEVICE2' database/schema/alter/moveDevices.sh 'sourceDGEXNAME' 'targetDGEXNAME' 'DEVICE3'
- Import device dependencies: (This entire step can be skipped if there are no device dependencies or you do not wish to retain device dependencies)
From <TRAVERSE_HOME>, where --user is the department level user and --pass is the corresponding password and --file is the list of device dependencies generated in the step above:
(Windows)
plugin\utils\importAndCreateDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --file c:\temp\list1.csv
(Linux)
plugin/utils/importAndCreateDependency.pl --user DEPARTMENTLEVELUSER --pass PA$$W0RD --file /root/temp/list1.csv
- Optimize db on upstream DGEs
If: the target DGE-X has a different upstream DGE, start components on both upstream DGEs and then run:
(Windows)
utils\db_optimize.pl --run --optimize
(Linux)
utils/db_optimize.pl --run --optimize
Else: (i.e. target DGE-X shared same upstream DGE as source DGE-X) run:
(Windows)
utils\db_optimize.pl --run
(Linux)
utils/db_optimize.pl --run
Once complete, start all Traverse services on the source and target DGE-X (and upstream DGEs if services were taken offline). If the target DGE-X does not share the same upstream DGE, when the source's upstream DGE reconnects to the BVE, it will delete data for the devices that have been moved out of it from its database. During this cleanup phase you may see some extra disk I/O and writer queue backlog, but that should settle down after a while.
RELATED ARTICLES: