Page 1 of 1

Syncing Performance and State Data between Nagios instances

Posted: Thu May 16, 2019 8:03 pm
by jaimie.livingston
Has anyone worked out an effective, scriptable method to sync ONLY performance and state data between two Nagios instances.

We use Mod-Gearman with a set of Nagios servers separated over WAN links. This works fine so long as all the Nagios servers are available to receive data from the workers.

However, there occasionally arises a situation where one or more servers in the set are taken offline and no longer receive performance and state information from the workers and fall out of sync with the other servers.

What I would like is an effective way to resync ONLY the performance and state data from the most up-to-date Nagios servers to those that have fallen behind. Preferably some method that can be automated via scripting.

Thanks,

Jaimie Livingston

Re: Syncing Performance and State Data between Nagios instan

Posted: Fri May 17, 2019 2:33 pm
by npolovenko
Hello, @jaimie.livingston. I do not have an efficient tested method but I can provide with some tips that can help you with setting this up.

To sync performance data between two servers you'll need to synchronize rrd and xml files in the /perfdata/ folder on one XI server with another.

Code: Select all

/usr/local/nagios/share/perfdata/
You can possibly look into rsync to sync the folder above or host perfdata on a shared network storage device and create symlinks to the folder on both XI servers.

Synchronizing state data will be a bit more challenging as it is stored in the database. (nagios_statehistory table in the nagios database). You'd need to dump the table on one XI and import it into another XI. Provided you don't want to backup-restore everything. Some users are using DB clustering software that syncs two db instances, but Nagios is known to not be 100% compatible with clustered DB and I've seen Nagios process crashing during backups.

Also, state history data used in Nagios reports is stored in the archived log files which are stored in /usr/local/nagios/var/archives So if you want to sync the state history data to run reports, then you'll need to sync all files in that folder as well, plus the most recent nagios.log file located in:

Code: Select all

/usr/local/nagios/var/nagios.log

Re: Syncing Performance and State Data between Nagios instan

Posted: Wed Jun 12, 2019 10:29 am
by jaimie.livingston
Thanks for the info.
From what you've provided, the perfdata probably won't pose a huge challenge.
I may just have to abandon syncing state data for now.

Thanks again.

Re: Syncing Performance and State Data between Nagios instan

Posted: Wed Jun 12, 2019 1:31 pm
by npolovenko
@jaimie.livingston. No problem. I'll be marking this thread as resolved.