Welcome to docs.opsview.com

Databases on a different server

This document details how to set up Opsview to use databases on a different database server, rather than running the database on the Opsview master server.

There will be an outage to the Opsview server during the backup and the restore. The majority of the time will be in the restore of the ODW database server - we recommend you perform a test restore to get timings before you follow this process on your production system.

Setup mysql on database server

The database server only requires MySQL (and its dependencies) to be installed (the opsview-agent package can optionally be installed if not using SNMP to monitor the database server).

Make sure mysql is listening on the appropriate interfaces.

Make sure other Opsview specific configuration changes have been made - see MySQL prerequisites.

Stop Opsview

You will need to stop Opsview to get a consistent snapshot of the database:

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

Backup databases

These instructions assume you will do a full database export, although you may use any technology to backup the mysql databases. Be aware that if the new database server is on a different architecture, you will need to do a database export.

mysqldump -u root -p --opt --databases opsview runtime odw dashboard| gzip -c > databases.sql.gz

Restore databases

On the new server, restore the databases:

gunzip -c databases.sql.gz | mysql -u root -p 

Check that the character set for the databases are the same as previous, otherwise you may have issues when upgrading:

mysql> show create database opsview;
| Database | Create Database                                                    |
| opsview  | CREATE DATABASE `opsview` /*!40100 DEFAULT CHARACTER SET latin1 */ |

Setup access controls

On Opsview master, update /usr/local/nagios/etc/opsview.conf with the new host information:

$dbhost = "hostname";
$odw_dbhost = "hostname";
$runtime_dbhost = "hostname";
$reports_dbhost = "hostname";
$dashboard_dbhost = "hostname";

Note: Runtime ($runtime_dbhost) and Opsview ($dbhost) need to be on the same host due to cross joins.

You will need to setup the access controls on the new database server to allow Opsview master to connect. From Opsview master, run:

/usr/local/nagios/bin/db_mysql -t > opsview_access.sql

This file contains all the access credential information. Transfer this file to the new database server and run:

mysql -u root -p < opsview_access.sql

For extra security, you may limit the access to only come from Opsview master.

Restart Opsview

On Opsview master, restart Opsview Web and regenerate the configuration for Opsview (this is required to update 3rd party software such as NDOUtils and Nagvis with the new connection information):

/usr/local/nagios/bin/rc.opsview gen_config
/etc/init.d/opsview-web start


Drop the old databases on the Opsview master server

mysql -u root -p
drop database opsview;
drop database odw;
drop database runtime;
drop database reports;
drop database dashboard;