Skip to end of banner
Go to start of banner

Migrating NMIS and Modules from CentOS 6 to CentOS 7

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 31 Next »

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.

Selinux Warning

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

1) Install prerequisite packages

After installing CentOS 7 on the new server install the following packages:

  • yum update
  • yum install perl
  • yum install perl-core
  • yum install rrdtool
  • yum install rrdtool-perl
  • yum install libpng12
  • yum install rsync
  • yum install ntp

You can run the two commands below to accomplish this.

Update | Install
yum update
yum install -y perl perl-core rrdtool rrdtool-perl libpng12 rsync ntp

2) 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.

  • Create /installs directory
  • Create a omk8_list.txt file with download links such as below:
omk8_list.txt
# Opmantek NMIS 8 downloads
# Update with newest links
# And Comment out what modules you do not need
https://dl-nmis.opmantek.com/nmis8.7.2-1.run
https://dl-omk.opmantek.com/opCharts-Linux-x86_64-3.6.0.run
https://dl-omk.opmantek.com/opReports-Linux-x86_64-3.4.2.run
https://dl-omk.opmantek.com/opConfig-Linux-x86_64-3.5.3.run
https://dl-omk.opmantek.com/opEvents-Linux-x86_64-2.6.5.run
https://dl-omk.opmantek.com/opFlow-Linux-x86_64-3.1.3.run
  • Create a omk8_downloader.sh file in the /installs directory, code below:
omk8_downloader.sh
#!/bin/bash

# Stop services
service opeventsd stop


upgrade_list=$(</installs/omk8_list.txt)

echo "starting downloads based on upgrade_list"
sleep 2
while read LINE; do `wget ${LINE}`; done < /installs/omk8_list.txt
echo "Downloads complete"
sleep 2
echo "##########"
echo "#"
echo "#		Starting installs"
echo "#"
echo "##########"

while IFS=/ read -r var1 var2 var3 var4 var5; do
	#echo $var1
	#echo $var2
	#echo $var3
	echo "Running install on $var4"
	`sh ./$var4 -- -y`
	sleep 2
	#echo $var5
done < /installs/omk8_list.txt

echo "##########"
echo "#"
echo "#		Installs Complete"
echo "#"
echo "##########"


3) 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.

  • Does Current server have valid key? cat ~/.ssh/id_rsa.pub
    • If yes copy "ssh-copy-id -i ~/.ssh/authorized_keys user@host
    • If no create ssh key then run ssh-copy-id command from above

4) Shutdown Related Services

  • On both the old CentOS 6 and the new CentOS 7 servers shutdown the following services:
    • opeventsd
    • opchartsd
    • opconfigd
    • opflowd
    • omkd
    • mongod

5) Edit /etc/cron.d/nmis and comment out all cron jobs

  • This should performed on both servers before running the script.


6) 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.

Please take into consideration that the new environment may store the database in different folders. Check your "dbpath" in your servers (/etc/mongod.conf).

  • 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.


exportNMIS_OMK.sh
#!/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/$NODE $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

7) Update your Mongo Config File on the New CentOS 7 Server

Update your /etc/mongod.conf to reflect the current configuration from your old CentOS 6 Server, note that the dbpath could be different from your old environment.  

8) Check & Correct Config Files

After Files are migrated run "/usr/local/nmis8/bin/nmis.pl type=config" to fix any errors that could be there from migration.

9) Correct NMIS Hostname on the New CentOS 7 Server

In /usr/local/nmis8/conf put the correct hostname for 'server_name' attribute.

10) Restart Related Services on the New CentOS 7 Server

Restart the following services:

  • mongod
  • omkd
  • opeventsd
  • opconfigd
  • opflowd
  • opchartsd

11) Verification

Log into the GUI on the new CentOS 7 server and verify each application is functional and presents data from before the migration.

  • No labels