Purpose
Customers that are running NMIS and OMK applications on CentOS 6 may want to move them to CentOS 7. Will article will present one method of accomplishing this.
Assumptions
The CentOS 7 server will run the same version of NMIS and OMK applications that are currently running on the CentOS 6 server.
Prerequisites
- Seliunx disabled or configured to allow NMIS/OMK installation.
- Firewall disabled or configured to allow all necessary OMK/NMIS network calls.
Procedure
Prepare Target CentOS 7 Server
Install prerequisite packages
After installing CentOS 7 on the new server install the following packages.
- yum update
- yum install perl
- yum intstall perl-core
- yum install rrdtool
- yum install rrdtool-perl
- yum install libpng12
- yum install rsync
- yum install ntp
Install NMIS and OMK Applications
Install the correct NMIS and OMK application versions on the new CentOS 7 server. If you no longer have the installer packages for the correct versions contact support@opmantek.com and someone will provide them.
Install SSH Keys
In order for the export script to work a valid ssh key must be installed in the /root/.ssh/authorized_keys file.
Shutdown Related Services
On both the old CentOS 6 and the new CentOS 7 servers shutdown the following services:
- opeventsd
- opconfigd
- opflowd
- omkd
- mongod
Run Export Script
Run the following script on the old CentOS 6 server. The following four variables at the top of the script will need to be modified to suit your environment.
- TARGET : IP address of the new CentOS 7 server.
- NODEDATA: Full path to the directory that contains NMIS node files.
- MONGODBLOC: Full path to the Mongo database directory.
- MONGODBDIR: The name of the directory that contains the MongoDB files.
#!/bin/sh TARGET=192.168.10.67 NODEDATA=/usr/local/nmis8/database/nodes MONGODBLOC=/var/lib MONGODBDIR=mongo NODES=$(fgrep "'name'" /usr/local/nmis8/conf/Nodes.nmis | awk '{print $3}' | tr "\'" ' ' | tr ',' ' ' | awk '{print $1}') # copy mongodb rsync --progress -av $MONGODBLOC/$MONGODBDIR $TARGET:$MONGODBLOC/. ssh $TARGET 'chown -R mongod:mongod $MONGODBLOC/$MONGODBDIR' for NODE in $NODES do # create a directory to store the node export JSON files. install -d $NODEDATA # export the node records from NMIS /usr/local/nmis8/admin/node_admin.pl act=export node=$NODE file=$NODEDATA/$NODE.json # get the node data to the target server rsync -avz -e ssh $NODEDATA/* $TARGET:$NODEDATA/ rsync -avz -e ssh /usr/local/nmis8/database/nodes/$NODE $TARGET:/usr/local/nmis8/database/nodes scp /usr/local/nmis8/var/$NODE* $TARGET:/usr/local/nmis8/var # remotely add the nodes to the TARGET server ssh -t $TARGET "/usr/local/nmis8/admin/node_admin.pl act=create node=$NODE file=$NODEDATA/$NODE.json" done # Update the group list with any new groups ssh -t $TARGET "/usr/local/nmis8/admin/grouplist.pl patch=true" # copy NMIS/OMK config rsync --progress -av /usr/local/nmis8/models root@$TARGET:/usr/local/nmis8/. rsync --progress -av /usr/local/nmis8/conf root@$TARGET:/usr/local/nmis8/. rsync --progress -av /usr/local/omk/conf root@$TARGET:/usr/local/omk/. # Fix file permissions ssh $TARGET /usr/local/nmis8/admin/fixperms.pl
Correct NMIS Hostname on the New CentOS 7 Server
in /usr/local/nmis8/conf put the correct hostname for 'server_name' attribute.
Restart Related Services on the New CentOS 7 Server
Restart the following services:
- mongod
- omkd
- opeventsd
- opconfigd
- opflowd
Verification
Log into the GUI on the new CentOS 7 server and verify each application is functional and presents data from before the migration.