Remove overrides in retention.dat

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
dv2kJLUPv
Posts: 8
Joined: Mon Dec 04, 2017 10:27 am

Remove overrides in retention.dat

Post by dv2kJLUPv »

Hello,

It seems someone has used the web interface to override whether notifications are enabled on certain services/hosts in the past. We're currently modifying the configuration files to disable some notifications on certain services, however I have noticed a variety of different hosts that use these services still have the notifications enabled for them.

After further digging, I learned nagios keeps "overrides" from the interface in the status.dat/retention.dat files. I thought I would simply be able to "undo" the change by reverting the notification state on the web interface, however it still sees it as a "modified attribute" in the retention.dat file.

is there anyway for me to remove these overrides so it starts inheriting directly from the configuration file again?

Thank you and Happy Christmas to you all!
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Remove overrides in retention.dat

Post by dwhitfield »

What version of Core are you using? Was it compiled from source or installed from distro repos? On what OS/version is nagios running? cat /etc/*-release may be of use. Those questions will help us determine file paths so that we can help you.

How are these overrides being done? Are the hosts/services being acknowledged?

Assuming it's not an acknowledgement, are you seeing
Your command request was successfully submitted to Nagios for processing.

Note: It may take a while before the command is actually processed.
when you send the enabling of the notifications? How long did you wait?
dv2kJLUPv
Posts: 8
Joined: Mon Dec 04, 2017 10:27 am

Re: Remove overrides in retention.dat

Post by dv2kJLUPv »

Hi dwhitfield,

It's running CentOS 6 and the files are located within

Code: Select all

/var/log/nagios
currently. However I think there's a slightly misunderstanding.

The web interface actions properly update everything, my problem is undoing those actions so it then inherits properly from the configuration files on the system.

For example, "Memory Usage" service is set to

Code: Select all

notifications_enabled 1
in the configuration file that defines the services.

Host A & Host B both have "Memory Usage" as a service associated to them. I then use the web interface to disable notifications for the service on Host B. I then later re-enable them via the web interface.

The following week we decide that service no longer needs notifications, so we update the configuration file on the server to

Code: Select all

notifications_enabled 0
. This updates Host A to not have notifications enabled for that service, however Host B sees what we did the other day as something more important than this config file still. It no longer is inheriting from the config file.

How can I reset a service on a host to ignore all customisations via the web panel so it starts listening to the actual configuration file again?

Thanks
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Remove overrides in retention.dat

Post by npolovenko »

@dv2kJLUPv, When you talked about modifying the configuration files, did you actually mean modifying the retention.dat file? You need to stop the Nagios process before modifying the retention.dat file.
If that doesn't help you may do something like this:
You also have to define the modified_attributes= directive so Nagios knows which entries in the retention.dat file will override the settings in the configuration files. This might seem overly complicated however this is normally controlled by the Nagios process, manually modifying the retention.dat is not commonly done.
https://support.nagios.com/kb/article.php?id=522
I think a better way to do this would be to modify the configs inside the service and hosts definitions in:
/usr/local/nagios/etc/...
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dv2kJLUPv
Posts: 8
Joined: Mon Dec 04, 2017 10:27 am

Re: Remove overrides in retention.dat

Post by dv2kJLUPv »

@npolovenko No I have modified the actual configuration files (which for us are located in

Code: Select all

/etc/nagios/conf.d/
); but these changes are not overriding the ones that have been "modified" in the retention.dat file.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Remove overrides in retention.dat

Post by npolovenko »

@dv2kJLUPv, The key here is to make sure that the Nagios process is stopped before you modify the retention file.
1.Stop nagios with

Code: Select all

service nagios stop
2.You may also run killall -9 nagiosto make sure there are no duplicate Nagios processes still running
3. After that, you may modify the retention file.
4. Start nagios with

Code: Select all

service nagios start
Also, any time after you modify the config files manually, you need to restart the nagios service with:

Code: Select all

service nagios restart
This command will force Nagios to reach out to the config files and populate everything on the web interface side.

Let us know if that helped. Otherwise, I would like to see all the definition files from:
/etc/nagios/conf.d/. You may run the following command:

Code: Select all

tar cvfz /tmp/definitions.tgz /etc/nagios/conf.d/*
And when done you should have a definitions.tgz file in /tmp/ folder. Download that folder to your computer using WinSCP or FileZilla and upload it with your next post.
Regards
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dv2kJLUPv
Posts: 8
Joined: Mon Dec 04, 2017 10:27 am

Re: Remove overrides in retention.dat

Post by dv2kJLUPv »

Hi @npolovenko,

Hope you had a lovely Christmas and new year.

I still think there's a bit of confusion here, I do not want to change the retention file.

I want to know how to undo / revert any changes that have been applied through the web interface so that everything is a direct result of what's specified in the /etc/nagios/conf.d/ and not being inherited from the retention file.

I have tried restarting nagios, and it still keeps any changes applied through the web interface instead of using the actual config definitions.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Remove overrides in retention.dat

Post by dwhitfield »

If you don't want to retain your state, then you can turn off state retention.
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 ... nformation
Locked