Migrating RackMonkey data to Device42

We are happy to open-source the Rackmonkey to Device42 migration script. The script is available at github repository: https://github.com/device42/RackMonkey-to-Device42-Migration

The script connects to your rackmonkey DataBase, get the data and sends it to Device42 appliance using the REST APIs.

Using this script, you can now migrate your rackmonkey data to Device42 in minutes. The requirements/how-to and gotchas etc. are discussed below.

Requirements

RackMonkey v1.2.5-1
Device42 v5.7.1.1394099009 and above
python 2.7.x
MySQLdb

You can run the script from any box that can connect to RackMonkey Database and Device42 via https. It could be the rackmonkey host itself or any other machine that satisfies the requirements.

To install MySQLdb, you need “MySQL-python” installed. On a base ubuntu 12.04 image, we had to do following. Your mileage may way depending on OS and version.

sudo apt-get install python-pip
sudo apt-get install libmysqlclient-dev
sudo apt-get install build-tools
sudo apt-get install python-dev
sudo pip install MySQL-python

How To

Once you have pre-requisites taken care of, take a look at the script migrate.py in that repository. It is basically ready to go, all you have to do is add credentials and info for your Device42 appliance and your rackmonkey database.

Enter Device42 URL and credentials, where it says:

D42_API_URL = 'https://D42_IP_or_FQDN'           # make sure to NOT to end in /
D42_USERNAME = 'D42USER'
D42_PASSWORD = 'D42PASS'

 

Enter Rackmonkey Database and credentials, where it says

 

host = 'localhost'    # Hostname for RackMonkey DB. This and values below should be available in Rackmonkey config file
user = 'rackmonkey'   # Username to connect to DB
passwd = ''           # Password to connect to DB
dbname = 'rackmonkey' # DB Name

Please note that you can get this info from you rackmonkey config file if you forgot.

Optionally, you can change certain assumptions as used in the script. You can change the values from True to False or vice versa, depending on your needs.

 

DEBUG = False
ADD_HIDDEN_RACKS = False
SEND_ROW_POS_FOR_RACK = False
HARDWARE_MODELS_ARE_ALL_RACKABLE = True
APPEND_DOMAIN_NAME_TO_DEVICE_NAME = False
ADD_ROLE_AS_CUSTOM_KEY = True
CSV_ERRORS_FILE_NAME = 'rmerrors.csv'

Once the script is ready, you can do

chmod +x migrate.py
./migrate.py

or

python migrate.py

As the script is running – all errors are logged in rmerrors.csv file (or the file name as set by CSV_ERRORS_FILE_NAME)

If successful, you should see your data in Device42.

Gotchas

  • If you have changed rackmonkey DB schema and customized the app to your need, you will need to adjust the script to send any additional data etc. Please refer to our API documentation or open a support ticket with us for any questions: https://docs.device42.com/apis/
  • We are not doing any migration of rackmonkey apps in this script yet. If you use the rackmonkey app->device relationship capabilities, you can modify the script to add Application Components to Device42. However, because the rackmonkey relationships are all user-defined, a customized script is required for migration of applications. If you need help with migration of application data, feel free to reach out to us in support at device42.com and we will be happy to assist.
  • Also, since rackmonkey shows U # in the middle of slots in the rack layout, you will need to change a global setting in Device42 to make your rack looks the same. Go to Tools | Settings | Global Settings and change the “Rack Number between U’s option” to Start At.

Data Migration Help

If you don’t have enough resources to perform the migration yourself – we can do the migration for you. We will give you instructions on how to grab a DB dump and we can do the data conversion for you!