Page 1 of 1

Nagios XI Mutliple instance

Posted: Tue Apr 11, 2017 8:25 am
by socgenindia
Hi ,

We want to keep single database for multiple nagios instance , while installing nagios it creates 3 database i.e nagios , nagiosql and nagiosxi . Is that possible to create different database name for different nagios instances. If so please tell me how to achive while installing nagios xi.

Re: Nagios XI Mutliple instance

Posted: Tue Apr 11, 2017 1:06 pm
by ssax
I labbed this up and it does look like it's possible.

*** Note: Make sure that you have known-good backups/vm snapshots before making any modifications and perform this in a test environment until your confident you don't have any outstanding issues!

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Here's what I did:

- Installed XI on two separate servers:
XI1 - 192.168.232.21
XI2 - 192.168.232.37
DB - 192.168.232.23

- Followed the offload instructions for both of them:

https://assets.nagios.com/downloads/nag ... Server.pdf

When it came time to create the databases:

DB Server:

Code: Select all

create database nagios_a;
create database nagios_b;
create database nagiosql_a;
create database nagiosql_b;
create database nagiosxi_a;
create database nagiosxi_b;
GRANT ALL ON nagios_a.* TO nagios@'192.168.232.21' IDENTIFIED BY 'nagios';
GRANT ALL ON nagios_b.* TO nagios@'192.168.232.37' IDENTIFIED BY 'nagios';
GRANT ALL ON nagiosql_a.* TO nagiosql@'192.168.232.21' IDENTIFIED BY 'nagiosql';
GRANT ALL ON nagiosql_b.* TO nagiosql@'192.168.232.37' IDENTIFIED BY 'nagiosql';
GRANT ALL ON nagiosxi_a.* TO nagiosxi@'192.168.232.21' IDENTIFIED BY 'nagiosxi';
GRANT ALL ON nagiosxi_b.* TO nagiosxi@'192.168.232.37' IDENTIFIED BY 'nagiosxi';
Then check the connectivity status from XI1:

Code: Select all

echo 'STATUS;' | mysql -u nagios -p'nagios' -h 192.168.232.23 nagios_a
echo 'STATUS;' | mysql -u nagiosql -p'nagiosql' -h 192.168.232.23 nagiosql_a
echo 'STATUS;' | mysql -u nagiosxi -p'nagiosxi' -h 192.168.232.23 nagiosxi_a
Then check the connectivity status from XI2:

Code: Select all

echo 'STATUS;' | mysql -u nagios -p'nagios' -h 192.168.232.23 nagios_b
echo 'STATUS;' | mysql -u nagiosql -p'nagiosql' -h 192.168.232.23 nagiosql_b
echo 'STATUS;' | mysql -u nagiosxi -p'nagiosxi' -h 192.168.232.23 nagiosxi_b
If there are any connectivity issues from the above commands they need to be fixed before moving onto the next portion.

Migrate the data:

On XI1:

Code: Select all

mysqldump -u root -p'nagiosxi' nagios | mysql -u nagios -p'nagios' -h 192.168.232.23 nagios_a
mysqldump -u root -p'nagiosxi' nagiosql | mysql -u nagiosql -p'nagiosql' -h 192.168.232.23 nagiosql_a
mysqldump -u root -p'nagiosxi' nagiosxi | mysql -u nagiosxi -p'nagiosxi' -h 192.168.232.23 nagiosxi_a
On XI2:

Code: Select all

mysqldump -u root -p'nagiosxi' nagios | mysql -u nagios -p'nagios' -h 192.168.232.23 nagios_b
mysqldump -u root -p'nagiosxi' nagiosql | mysql -u nagiosql -p'nagiosql' -h 192.168.232.23 nagiosql_b
mysqldump -u root -p'nagiosxi' nagiosxi | mysql -u nagiosxi -p'nagiosxi' -h 192.168.232.23 nagiosxi_b
Now update the config files on XI1 AND XI2 following the 2 – Adjust Settings on Nagios Server on page 8 and follow to the end of the guide, make sure to use the proper DB names:

On XI1 - Use nagios_a, nagiosql_a, and nagiosxi_a for the DB names in all of the config files

On XI2 - Use nagios_b, nagiosql_b, and nagiosxi_b for the DB names in all of the config files

If you are having problems, please include these files from both servers:

Code: Select all

/usr/local/nagios/etc/ndo2db.cfg
/usr/local/nagiosxi/html/config.inc.php
/var/www/html/nagiosql/config/settings.php
/root/scripts/automysqlbackup
Thank you

Re: Nagios XI Mutliple instance

Posted: Tue Apr 11, 2017 1:21 pm
by socgenindia
Thank you, we will try and let you know the results.

Re: Nagios XI Mutliple instance

Posted: Tue Apr 11, 2017 1:42 pm
by ssax
Great, just let us know if you run into any issues and we can help you work through them.

Thank you