...
Note | ||
---|---|---|
| ||
If selinux is enabled and at its default configuration during the NMIS installation perl modules will be installed with the wrong path. This will cause NMIS to be non-functional. |
Procedure
Prepare Target CentOS 7 Server
...
- opeventsd
- opconfigd
- opflowd
- omkd
- mongod
edit /etc/cron.d/nmis and comment out all cron jobs
This should performed on both servers before running the script.
Run Export Script
Run the following script on the old CentOS 6 server. The following six 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.
- SOURCE_MONGODBLOCATION: Full path to the current Mongo database directory to be migrated.
- SOURCE_MONGODBDIR: The name of the directory that contains the current MongoDB files.
- DESTINATION_MONGODBLOCATION: Full path to the new Mongo database directory.
- DESTINATION_MONGODBDIR: The name of the directory that will receive the MongoDB files.
...
Code Block | ||
---|---|---|
| ||
#!/bin/sh TARGET=192.168.10.67 NODEDATA=/usr/local/nmis8/database/nodes SOURCE_MONGODBLOCATION=/data SOURCE_MONGODBDIR=mongodb DESTINATION_MONGODBLOCATION=/var/lib DESTINATION_MONGODBDIR=mongo NODES=$(fgrep "'name'" /usr/local/nmis8/conf/Nodes.nmis | awk '{print $3}' | tr "\'" ' ' | tr ',' ' ' | awk '{print $1}') # copy mongodb rsync --progress -av $SOURCE_MONGODBLOCATION/$SOURCE_MONGODBDIR $TARGET:$DESTINATION_MONGODBLOCATION/. ssh $TARGET "chown -R mongod:mongod $DESTINATION_MONGODBLOCATION/$DESTINATION_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 |
...