Page 1 of 1

Can't turn off notifications on a service

Posted: Fri Jul 12, 2019 11:21 am
by rocheryderm
So...

I've got this service that inherits from a template. The template has notifications enabled ("on"), but the service specifically sets notifications to "off".

And yet, I continue to get emails when the service status changes.

Is this a known problem? Am I misunderstanding how object inheritance works?

I'm using the Nagios xi GUI to make these settings on the "Alert Settings" tab of Services and Service Template configuration, in "Notification enabled" either "off" or "on"

I've checked, double-checked, triple-checked... I've got to make the alerts stop! :cry:

Re: Can't turn off notifications on a service

Posted: Fri Jul 12, 2019 12:10 pm
by lmiltchev
It's possible that nagios ignores the notification settings in the service config as you have state retention enabled in the nagios.cfg file.

What happens when you go to Home > Details > Service Status, click on your service, then click on the "Disable notifications" link under the "Quick Actions" section? Do notifications stop?

Re: Can't turn off notifications on a service

Posted: Fri Jul 12, 2019 2:04 pm
by rocheryderm
OK... I've been using Nagios for over 10 years, and I've never worried about the retention setting (leaving it at default)

However... now that I'm reading about it... should it be disabled if I intend to use templates to control service states?

My assumption was that making a change to the templates or services would take effect when applying the configuration - is that inaccurate? This seems like a newbie misunderstanding - if so please point me to what I should be reading/viewing to get a better handle on this.

To answer your question, disabling notifications from the GUI to the entire servicegroup was effective. But I want to make these wide sweeping changes by template. For example, I have various services inheriting from multiple tiers of templates with the idea that I can make wide, sweeping changes with single template modifications.

Do I need to disable retention-state for this to work?

Re: Can't turn off notifications on a service

Posted: Fri Jul 12, 2019 2:59 pm
by lmiltchev
However... now that I'm reading about it... should it be disabled if I intend to use templates to control service states?
This is a difficult question... On one hand, you would like nagios to retain state. On the other hand, it's a bit confusing when you modify a directive in a config, e.g. a template, but changes don't take effect immediately. You can change the following line in the nagios.cfg from this:

Code: Select all

use_retained_program_state=1
to this:

Code: Select all

use_retained_program_state=0
and restart nagios:

Code: Select all

service nagios restart
Keep in mind that this way, if someone on your team makes a change in the GUI, and configuration is applied, the changes will take effect immediately. This will include program-wide state variables, such as enable_notifications, enable_flap_detection, enable_event_handlers, execute_service_checks, and accept_passive_service_checks options. You can give it a try to see if this is what you would like to use.
My assumption was that making a change to the templates or services would take effect when applying the configuration - is that inaccurate? This seems like a newbie misunderstanding - if so please point me to what I should be reading/viewing to get a better handle on this.
Applying configuration will not change the "current state" of the program-wide state variables mentioned above, when using the default option:

Code: Select all

use_retained_program_state=1
See this: https://assets.nagios.com/downloads/nag ... gram_state

Also, modifying a template would not make a difference if the directive is defined locally (on a service level), as local variables always take precedence over variables inherited from a template.

For example, you may have 50 services that use the same template. You have:

Code: Select all

notifications_enabled           1
in the template, and you would like to disable notifications in bulk for all 50 services by modifying the template. You change the option to:

Code: Select all

notifications_enabled           0
and apply configuration. You know that you have:

Code: Select all

use_retained_program_state=0
so this should work, right? Well, it will work for services that have "Skip" option selected in the CCM (that would inherit the variable from the template). If any of the services have:

Code: Select all

notifications_enabled           1
defined locally (on the service level), changing the template won't do a thing.

See this: https://assets.nagios.com/downloads/nag ... tance.html
Do I need to disable retention-state for this to work?
Again, it is your decision to make. I would recommend that you try this in a test environment first before applying it to production. Each Nagios XI license is approved for up to three installations: one primary monitoring/production, one backup/failover, and one test environment.

https://support.nagios.com/kb/article/n ... s-145.html

Hope this helps.