Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagetext
titleomk8_list.txt
#Opmantek# Opmantek NMIS 98 downloads
#Comment# 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.56.20.run
https://dl-omk.opmantek.com/opReports-Linux-x86_64-3.45.20.run
https://dl-omk.opmantek.com/opConfig-Linux-x86_64-3.56.30.run
https://dl-omk.opmantek.com/opEvents-Linux-x86_64-2.67.50.run
https://dl-omk.opmantek.com/opFlow-Linux-x86_64-3.1.2.0.run
https://dl-omk.opmantek.com/opHA-Linux-x86_64-2.3.0.run
  • Create a omk8_downloader.sh file in the /installs directory, code below:
Code Block
languagebash
titleomk8_downloader.sh
linenumberstrue
#!/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 "##########"

...

  • 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

...

  • 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

Note
titledf-h

Before running this script below, ensure there is enough space on the target machine to transfer all of the data. Running df -h in the terminal will show you the free disc space.


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.

...

Code Block
titleexportNMIS_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

...

9) Correct NMIS Hostname on the New CentOS 7 Server

In Config.nmis located at /usr/local/nmis8/conf put the correct hostname for 'server_name' attribute.

...