Page 1 of 1

Re-Enable Checks or Alerting Automatically

Posted: Wed Jun 26, 2019 5:11 pm
by mmccaugh
OK if this has been asked before I apologize, I have to believe it has been but I cannot seem to find it.

But is there a way to automate a period after which host checks, or notifications will automatically be re-enabled? The issue I am trying to solve is notifications get silenced due to work, or an outage but then they are simply forgotten and left disabled.. Or invalid service checks are defined, and rather than raise this so the checks themselves can be corrected they are just turned off.

I am looking at how I can make this impossible, by defining a period after which any disabled alert will be re-enabled.. Note I believe I could do this with a cron job and some creativity, but what I want would be a rolling window.. Say after 48 hours re-enable, not "At 4am sunday re-enable everything disabled"

I want people to be able to disable alerts for maintenance, but not just forget about them and never re-enable..

Re: Re-Enable Checks or Alerting Automatically

Posted: Thu Jun 27, 2019 2:31 pm
by mcapra
mmccaugh wrote:The issue I am trying to solve is notifications get silenced due to work, or an outage but then they are simply forgotten and left disabled
It's better to put the particular problem into a downtime state if you want to temporarily silence notifications, IMO.
downtime.PNG
mmccaugh wrote:Say after 48 hours re-enable, not "At 4am sunday re-enable everything disabled"
I think you'd need a Cron job and some custom scripting for this.

Nagios Core has an external commands file that acts as an "API" of sorts, allowing you to execute Nagios commands available on the GUI (like notification enable/disable) via the command line. Here's a list of the available commands:
https://assets.nagios.com/downloads/nag ... ernalcmds/

In terms of assessing a particular object's state, the JSON CGIs are pretty accessible -- these should already be installed with a modern Nagios Core installation. The notifications_enabled flag is what you're looking for when determining whether or not a particular host/service object has had notifications enabled/disabled. =1 is enabled I believe.

I can't think of a reliable way to check the "time when notifications were disabled" bit off the top of my head.

Re: Re-Enable Checks or Alerting Automatically

Posted: Fri Jun 28, 2019 10:20 am
by jomann
mcapra is correct in the ways to do this, I am also not sure of a way to check when the notifications were disabled, but you could certainly record when they were disabled via the script somewhere that could then be read later for enabling.