Page 2 of 3
Re: Offloading Nagios XI DB
Posted: Mon Sep 30, 2013 3:37 pm
by jbennett
How would one go about forwarding the checks? (Sorry if this is onviously outlined in some document somewhere)
Re: Offloading Nagios XI DB
Posted: Tue Oct 01, 2013 7:37 am
by sreinhardt
You would find this under Admin-> Outbound\Inbound Transfers. Set this up on both systems and it should work straight away.
Re: Offloading Nagios XI DB
Posted: Thu Oct 03, 2013 10:57 am
by jbennett
I have offloaded the DB on my test environment to a remote system successfully.
Now, I've created a backup on my live system and want to restore it on the test system. The live system doesn't have the DB offloaded yet.
When I restore, will the test system be running the DB on the test box or on the remote DB test box?
Also, I just realized my live system is a 64-bit system while my test system is a 32-bit system.
Is there anything I need to be concerned about there?
(Yes, I realize that I should have a mirror image of the live system as my test system but this is what I have to work with right now).
Re: Offloading Nagios XI DB
Posted: Thu Oct 03, 2013 11:34 am
by sreinhardt
(Yes, I realize that I should have a mirror image of the live system as my test system but this is what I have to work with right now).
No worries, it's just great that you have a test system!
The restore should respect how you have it presently configured as far as I know. So since you should have it offloaded already, it should take that into consideration and apply the changes to the remote database but still keep plugins, rrds and such locally. As for changing architectures, you will have some things to keep in mind. Specifically if you look at the backup and restore documentation there are a few steps at the bottom that should recompile the normal nagios plugins and such to work with the change. Hopefully rrds should not have issues for you.
Re: Offloading Nagios XI DB
Posted: Thu Oct 03, 2013 3:51 pm
by jbennett
I'm trying to restore currently but I keep running into an error.
Code: Select all
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Error restoring MySQL database 'nagios' - check the password in this script!
Per the offloading the DB
documentation, I changed some passwords in some config files:
a) Change/Verify settings in ndo2db.cfg
Now the MySQL business is done, we simply need to point Nagios in the right direction. First we need to edit the ndo2db.cfg file which
is located in the etc/ directory of your Nagios install. For safety reasons its a good idea to make a backup:
cp /usr/local/nagios/etc/ndo2db.cfg /usr/local/nagios/etc/ndo2db.bak
vi /usr/local/nagios/etc/ndo2db.cfg
db_servertype=mysql
db_host=<IP_OF_REMOTE_MYSQL>
db_port=3306
db_user=nagios
db_pass=nagios
I've tried editing the restore script (/usr/local/nagiosxi/scripts/restore_xi.sh) and changed the password to reflect the above but I still get the error. When I check the script again, it seems to have reverted the changes?
I change:
Code: Select all
# MySQL root password
mysqlpass="nagiosxi"
to:
Code: Select all
# MySQL root password
mysqlpass="nagios"
But when I check after the restore fails, it's back to
Code: Select all
# MySQL root password
mysqlpass="nagiosxi"
Re: Offloading Nagios XI DB
Posted: Thu Oct 03, 2013 5:20 pm
by scottwilkerson
this is because your backup includes and restores the restore script also, and I would assume you have a different password on each system..One nagiosxi and one nagios
Re: Offloading Nagios XI DB
Posted: Fri Oct 04, 2013 11:19 am
by jbennett
sreinhardt wrote:You would find this under Admin-> Outbound\Inbound Transfers. Set this up on both systems and it should work straight away.
Ok - I've made the following changes:
On the new test machine, I've gone to Inbound Transfers -> NSCA. I've edited /etc/xinetd.d/nsca and added the IP of the live machine to the 127.0.0.1 IP as such:
Code: Select all
only_from = 127.0.0.1,xx.xx.xx.xx
I then went to Inbound Transfers under the Admin pannel -> NSCA tab and left the decryption to none and entered a password in the password field.
On the live machine, I went to Outbound Transfers -> NRDP -> and put the check next to 'Enable NRDP Output', I then put the IP of the test machine in, selected HTTPS, and copied the auth token to be the same as what I'm using on the live machine.
I then went to the NSCA tab, put a check in the 'Enable NSCA Output' box and entered the IP of the test machine, selected no encryption, and entered the password from the test machine NSCA tab.
Is this all correct?
Re: Offloading Nagios XI DB
Posted: Fri Oct 04, 2013 11:49 am
by slansing
Yes that all looks correct, have you tested it yet?
Re: Offloading Nagios XI DB
Posted: Fri Oct 04, 2013 1:04 pm
by jbennett
I have made these changes, but I don't think I'm offloaded after restoring the configs from the live system.
When I went through and checked the files indicated in the Offloading MySQL to Remote server ( ndo2db.cfg, config.inc.php, settings.php) on the test system, they had been reverted to the settings as they are on the live system. I tried adjusting them per the document, and how they should have been from when I tested offloading old data, I got only a blank page when I went to the Nagios address.
My question then is would doing a mysql dump ontop of old data cause a problem? Since I had already tested offloading on this sytem with old data, would doing a mysqldump of the data restored from the live system onto the test system cause problems?
Re: Offloading Nagios XI DB
Posted: Fri Oct 04, 2013 2:06 pm
by sreinhardt
It should not cause an issue to dump again, as I believe it should overwrite the indexes and such so that only the newest dump is available. However there is an additional file you may have missed(I just did a presentation on database alterations), I would guess that some of the password files may also have localhost alterations that are needed. Specifically I would look at the xi-sys.cfg
Root MYSQL Password
Code: Select all
mysqladmin -u root -pnagiosxi password NewPassword
/root/scripts/automysqlbackup
PASSWORD=NewPassword
/usr/local/nagiosxi/scripts/backup_xi.sh
mysqlpass="NewPassword"
/usr/local/nagiosxi/scripts/restore_xi.sh
mysqlpass="NewPassword"
/usr/local/nagiosxi/var/xi-sys.cfg
mysqlpass='NewPassword'
NagiosQL User
Code: Select all
/usr/local/nagiosxi/html/config.inc.php:
"pwd" => 'n@gweb',
"password" => 'n@gweb',
/usr/local/nagiosxi/html/config.inc.dist:
"pwd" => 'n@gweb',
"password" => 'n@gweb',
/usr/local/nagiosxi/html/config.inc.saved:
"pwd" => 'n@gweb',
"password" => 'n@gweb',
/usr/local/nagiosxi/etc/components/ccm_config.inc.php:
"password" => "n@gweb",
/usr/local/nagiosxi/html/includes/components/ccm/config.inc.php:
'password' => 'n@gweb',
/usr/local/nagiosxi/html/includes/components/ccm/ccm.inc.php:
$password = grab_array_var($cfg['db_info'
['nagiosql'],'pwd','n@gweb');
NDOutils user
Code: Select all
/usr/local/nagios/etc/ndo2db.cfg
db_pass=n@gweb
/usr/local/nagiosxi/html/config.inc.php:
"pwd" => 'n@gweb',
/usr/local/nagiosxi/html/config.inc.dist:
"pwd" => 'n@gweb',
/usr/local/nagiosxi/html/config.inc.saved: "pwd" => 'n@gweb',
/usr/local/nagvis/etc/nagvis.ini.php
dbpass="n@gweb"