Where and how is the state data for Nagios XI stored? Is it in the retention cache or the database or both? What's used when the application startups up and what's updated when a check/host changes state?
-Kendall Chenoweth
nagios state data
Re: nagios state data
The file that you're looking for is called retention.dat - typically it can be found in the /usr/local/nagios/var/ directory.Where and how is the state data for Nagios XI stored?
This file is used to determine all of the startup states of your hosts/services. Let me know if you have any questions.What's used when the application startups up and what's updated when a check/host changes state?
Re: nagios state data
A little clarification to this question. I'm working with Kendall on implementing a HA solution for Nagios XI that will look something like this:
There will be two Nagios XI servers, one in each of our two data centers. The nagios and nagiosql databases will be offloaded to dedicated MySQL servers that will be configured for circular database replication. On top of all of this, will be scripts similar to the ones found in the following documentation, that have been modified to use NCPA to check the nagios process and MySQL connections, to ensure that only one Nagios instance is running at a time.
http://nagios.sourceforge.net/download/ ... sHA_EN.pdf
We are currently running in to an issue in our testing, where certain state data like scheduled downtime and service acknowledgements not persisting in the database after a failover. It seems that the second Nagios process does not read this from the database, but is instead reading from some cache files (retention.dat, objects.cache, status.dat) and repopulating the database on startup.
Can you please shed some light on how the database and cache files are used during startup and lifecycle of the Nagios process? What would need to be synchronized between our two Nagios servers to ensure we do not lose any (or minimal) state information during a failover? Do you have any other recommendations for this failover process?
Thanks,
Jonathan
There will be two Nagios XI servers, one in each of our two data centers. The nagios and nagiosql databases will be offloaded to dedicated MySQL servers that will be configured for circular database replication. On top of all of this, will be scripts similar to the ones found in the following documentation, that have been modified to use NCPA to check the nagios process and MySQL connections, to ensure that only one Nagios instance is running at a time.
http://nagios.sourceforge.net/download/ ... sHA_EN.pdf
We are currently running in to an issue in our testing, where certain state data like scheduled downtime and service acknowledgements not persisting in the database after a failover. It seems that the second Nagios process does not read this from the database, but is instead reading from some cache files (retention.dat, objects.cache, status.dat) and repopulating the database on startup.
Can you please shed some light on how the database and cache files are used during startup and lifecycle of the Nagios process? What would need to be synchronized between our two Nagios servers to ensure we do not lose any (or minimal) state information during a failover? Do you have any other recommendations for this failover process?
Thanks,
Jonathan
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: nagios state data
Unsupported by us, just an FYIjbouvier wrote:dedicated MySQL servers that will be configured for circular database replication
jolson's answer is pretty complete. status.dat and objects.cache are transient. The only "cache" file (as cache pertains to startup) is retention.dat and when your 2nd instance is populating the ndo db that's where it's getting the data from.jbouvier wrote:Can you please shed some light on how the database and cache files are used during startup and lifecycle of the Nagios process?
Main Configuration File Options wrote:State Retention Option
Format: retain_state_information=<0/1>
Example: retain_state_information=1
This option determines whether or not Nagios will retain state information for hosts and services between program restarts. If you enable this option, you should supply a value for the state_retention_file variable. When enabled, Nagios will save all state information for hosts and services before it shuts down (or restarts) and will read in previously saved state information when it starts up again.
0 = Don't retain state information
1 = Retain state information (default)
https://assets.nagios.com/downloads/nag ... ios-XI.pdfjbouvier wrote:Do you have any other recommendations for this failover process?
-
kendallchenoweth
- Posts: 195
- Joined: Fri Sep 13, 2013 10:43 am
Re: nagios state data
I'm trying to understand when the retention file and database is updated and what software uses each.
This is what I think happens. On startup Nagios Core uses the retention file to populate initial state. Ndo2db reads from the retention file to populate state data for the Nagios XI interface. The state data is updated via Nagios Core checks into the retention file as Nagios Core continues to execute checks and ndo2db periodically (how often?) updates the mysql database which is used solely to present data via the Nagios XI interface.
Is this correct?
Thanks!
This is what I think happens. On startup Nagios Core uses the retention file to populate initial state. Ndo2db reads from the retention file to populate state data for the Nagios XI interface. The state data is updated via Nagios Core checks into the retention file as Nagios Core continues to execute checks and ndo2db periodically (how often?) updates the mysql database which is used solely to present data via the Nagios XI interface.
Is this correct?
Thanks!
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: nagios state data
That's a good summation.kendallchenoweth wrote:This is what I think happens. On startup Nagios Core uses the retention file to populate initial state. Ndo2db reads from the retention file to populate state data for the Nagios XI interface. The state data is updated via Nagios Core checks into the retention file as Nagios Core continues to execute checks and ndo2db periodically (how often?) updates the mysql database which is used solely to present data via the Nagios XI interface.
Is this correct?
kendallchenoweth wrote:Nagios Core continues to execute checks and ndo2db periodically (how often?)
Main Configuration File Options wrote:Automatic State Retention Update Interval
Format: retention_update_interval=<minutes>
Example: retention_update_interval=60
This setting determines how often (in minutes) that Nagios will automatically save retention data during normal operation. If you set this value to 0, Nagios will not save retention data at regular intervals, but it will still save retention data before shutting down or restarting. If you have disabled state retention (with the retain_state_information option), this option has no effect.