Opsview Knowledge Center

Migrating Opsview Monitor to new hardware

Learn how to migrate your Opsview Monitor to new hardware

Purpose

These instructions are intended to take an Opsview Monitor system running in one location and migrate it to another location. Depending on the goal of the migration, the installation of Opsview Monitor at the new location might include installing a newer version of the product.

You may also like to see the documentation here.

Steps

Note: All steps are to be performed as the root user unless stated otherwise.

  1. Stop all Opsview services that are communicating with the database

    1. For version 4.X, this is typically accomplished as follows:

      /etc/init.d/opsview stop
      /etc/init.d/opsview fullstop
      /etc/init.d/opsview-web stop

      For version 5.X, this is accomplished as follows:

      /opt/opsview/watchdog/bin/opsview-monit -g opsview stop

    2. If you use the reporting module, stop the service as follows:

      /etc/init.d/opsview-reporting-module stop

  2. Dump the MySQL database permissions to a file

    1. su -c '/usr/local/nagios/bin/db_mysql -t; /opt/opsview/jasper/bin/db_mysql -t' nagios > /tmp/opsviewdb.permissions.sql

    2. If you have the reporting module installed, export the jasperserver db permissions and append to the file that was created in step 2a.

      su -c '/opt/opsview/jasper/bin/db_mysql -t' opsview >> /tmp/opsviewdb.permissions.sql

  3. Transfer the file created in step #2 to the new database server

    1. scp /tmp/opsviewdb.permissions.sql [NEW_DB_SERVER]:/tmp

  4. Dump the MySQL database and save it to a compressed sql file Note: you will need to enter the root db password

    1. Log into the database server (this might be the same system that runs Opsview Monitor)
    2. Execute the following command and save it to an area that has ample space (this example will save it to /tmp/opsview.sql.gz)

      (echo "SET foreign_key_checks = 0;" ; mysqldump -u root -p --databases runtime opsview odw dashboard ) | gzip > /tmp/opsview.sql.gz

    3. If you have the reporting module installed, export the jasperserver db and append it to the file in step 4.2

      mysqldump -u root -p --databases jasperserver | gzip >> /tmp/opsview.sql.gz

  5. Transfer the file created in step #4 to the new database server

    1. scp /tmp/opsview.sql.gz [NEW_DB_SERVER]:/tmp

  6. Import the db dump on the new database server
    Note: this might take a long time
    Note: you will need to enter the root db password

    1. Log into the new database server
    2. gzip -d < /tmp/opsview.sql.gz | mysql -u root -p

  7. Import the permissions file from step #2 on the new database server Note: you will need to enter the root db password

    1. mysql -u root -p < /tmp/opsviewdb.permissions.sql

  8. Install Opsview on the new Master server

    1. Follow the standard instructions for creating the repository file
    2. Follow the standard instructions for performing a manual install
  9. Migrate custom configuration and status files from the old server and make sure that the ownership and permissions are the same
    Note: If you are migrating a version before 4.6, you will not have the sw files

    1. /usr/local/nagios/etc/opsview.conf

    2. /usr/local/nagios/etc/map.local

    3. /usr/local/nagios/etc/sw.key

    4. /usr/local/nagios/etc/sw/*

      (directory with all files within)

    5. /usr/local/opsview-web/opsview_web_local.yml

    6. /usr/local/nagios/share/stylesheets/custom.css

    7. Apache configuration files

  10. Update opsview.conf on the new server to point to the correct database

  11. Migrate custom plugins, event handlers, and notification scripts to the new master
    Verify that the new master is able to reach the database

  12. su -c
    '/usr/local/nagios/bin/db_opsview db_exists && echo "Successfull connected"' nagios

  13. If you see an error from the prevous command, please stop the migration process and get help

  14. If the previous step succeeds, run the postinstall_root script to finish the installation

    1. /usr/local/nagios/installer/postinstall_root -p [ROOT_PASSWORD] -h [DATABASE_IP_ADDRESS]

  15. Validate the installation

    1. Verify no errors in /var/log/opsviewd.log
    2. Verify that the Web UI is running and you are able to log in
    3. Verify that the status information in the UI is getting updated

Migrating Opsview Monitor to new hardware

Learn how to migrate your Opsview Monitor to new hardware