Hello,
I have spent the better part of a week reading and trying solutions for my issue so I thought I'd ask here as well.
I have the following situation(I will simplify for clarity):
3 sites to monitor(A B and C), two NagiosXIs(in A and B).
NagiosXI A, monitoring site A, site B and site C
NagiosXI B, monitoring site A, site B and site C
I don't want to have to configure twice all my services so I thought of using backup_xi script to push config from NagiosXI A to NagiosXI B and restore it there, however I ran in the following questions:
1. NagiosXI A and B have different IP addresses and I will have to install License B to NagiosXI B after every "replication" - can anyone point me to a source of information how to exclude the licensing backup from backup_xi script?
2. I want to be able to see the performance data on NagiosXI B. As far as I read with backup-restore I will overwrite it. I run into three questions here:
2.a. Where are all the places the historical data is stored, so I can skip them during the backup-restore procedure?
2.b. Service IDs incremental - as I see in nagiosql.tbl_service. When we apply the configuration the database gets written to the config files, but does it erase all previous config files? I ask this because I am afraid that I will have service X replicated once, then delete it, then configure some other services, then service X again and it might confuse the NagiosXI B if the config file was not deleted and now there are two service Xes.
2.c. This is still tied with the performance data - is it bound to service ID(incremental and unique), or is it bound by some other parameter?
3. Integration with Fusion - I suppose it is not such a big deal to have two XIs with the same fuse key in Nagios Fusion, but is there some relation between the fuse key and license/IP address/some random attribute that I have to be aware of, so I don't break integration every time I replicate configuration?
I know these can be dug out by browsing in the database and I am browsing it and I got a great deal of the picture by myself so far, but I want to be sure that I haven't missed some small detail.
Replication will be done once or twice a day, or on demand, so I don't mind if the replication method is slow - if you know any better method than modifying the backup_xi script I will appreciate it.
Thanks.
Separate NagiosXIs with overlapping regions
Re: Separate NagiosXIs with overlapping regions
1. NagiosXI A and B have different IP addresses and I will have to install License B to NagiosXI B after every "replication" - can anyone point me to a source of information how to exclude the licensing backup from backup_xi script?
That functionality doesn't exist, you will need to perform/script some post-restore changes in order to change that information.
You can follow the "After The Restore" section from this guide:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
2.a. Where are all the places the historical data is stored, so I can skip them during the backup-restore procedure?
Historical data is located in these locations:
DBs:
2.b. Service IDs incremental - as I see in nagiosql.tbl_service. When we apply the configuration the database gets written to the config files, but does it erase all previous config files? I ask this because I am afraid that I will have service X replicated once, then delete it, then configure some other services, then service X again and it might confuse the NagiosXI B if the config file was not deleted and now there are two service Xes.
The config files should be cleaned up on the apply configuration, I would run an apply configuration after you've done your post-restore changes as the last step. You can run /usr/local/nagiosxi/scripts/reconfigure_nagios.sh to do it.
2.c. This is still tied with the performance data - is it bound to service ID(incremental and unique), or is it bound by some other parameter?
It is bound by the hostname and the service name, they are exact and case-sensitive:
Performance graph data is stored in /usr/local/nagios/share/perfdata/HOSTNAME in rrd files:
3. Integration with Fusion - I suppose it is not such a big deal to have two XIs with the same fuse key in Nagios Fusion, but is there some relation between the fuse key and license/IP address/some random attribute that I have to be aware of, so I don't break integration every time I replicate configuration?
The same fusekey will work fine for both, while it may be considered a security issue it should still work.
You can always have your post-restore script/procedure change the fusekey via a command like this:
First you would generate one for your DR server:
Save that value permanently somewhere.
Then your post-restore would do something like this:
Let us know if you have any questions.
Here is our doc for HA but you have limited options with it being active/active:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
That functionality doesn't exist, you will need to perform/script some post-restore changes in order to change that information.
You can follow the "After The Restore" section from this guide:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
2.a. Where are all the places the historical data is stored, so I can skip them during the backup-restore procedure?
Historical data is located in these locations:
DBs:
Files:nagios - This is the historical statuses/history (data location /var/lib/mysql/nagios)
nagiosql - This is the current Core Config Manager configuration (data location /var/lib/mysql/nagiosql)
nagiosxi - This is where all the XI specific options/settings from Admin, dashboards, views, etc are stored (data location /var/lib/mysql/nagiosxi)
Code: Select all
/usr/local/nagios/var/nagios.log
/usr/local/nagios/var/archives/*
/var/lib/mrtg
/etc/mrtg
/usr/local/nagios/share/perfdata
/store/backups/The config files should be cleaned up on the apply configuration, I would run an apply configuration after you've done your post-restore changes as the last step. You can run /usr/local/nagiosxi/scripts/reconfigure_nagios.sh to do it.
2.c. This is still tied with the performance data - is it bound to service ID(incremental and unique), or is it bound by some other parameter?
It is bound by the hostname and the service name, they are exact and case-sensitive:
Performance graph data is stored in /usr/local/nagios/share/perfdata/HOSTNAME in rrd files:
Code: Select all
ls -l /usr/local/nagios/share/perfdata/HOSTNAME/SERVICENAME.rrd
ls -l /usr/local/nagios/share/perfdata/HOSTNAME/SERVICENAME.xmlThe same fusekey will work fine for both, while it may be considered a security issue it should still work.
You can always have your post-restore script/procedure change the fusekey via a command like this:
First you would generate one for your DR server:
Code: Select all
php -r 'echo strtoupper(md5(uniqid()));'Then your post-restore would do something like this:
Code: Select all
mysql -uroot -pnagiosxi nagiosxi -e "update xi_options set value = 'YOURPERMANENTDRKEY' where name = 'fusekey';"Here is our doc for HA but you have limited options with it being active/active:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Re: Separate NagiosXIs with overlapping regions
Thanks a lot for your reply, you really filled some big gaps in my knowledge. I will work on the migration script and if something not too site specific comes out of this I will share it for others to use.
Re: Separate NagiosXIs with overlapping regions
No problem, glad to help! Sounds good, I'm sure future readers will appreciate that.