My Nagios Users Are Forgetful

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
Master_Chief_Jon
Posts: 23
Joined: Fri Nov 19, 2010 1:31 pm

My Nagios Users Are Forgetful

Post by Master_Chief_Jon »

What if...
one of my Nagios users disables the notifications on one (or a few) service checks, and forgets to re-enable those notifications? Is there a command that I can run from a script to re-enable all host and service check notifications? Note that I am not talking about the global enable/disable notifications setting. I already know how to do that. I'm asking about a way to re-enable every individual host/svc check in a single command. I would like to run a script that runs this command every night (or maybe every other night) in cron, so our On-Call person actually receives notifications that something is wrong.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: My Nagios Users Are Forgetful

Post by mcapra »

The workflow I'd use: This only works for users who physically went to the Nagios GUI and "disabled notifications" that way. Or they submit an external command to disable the notifications. This doesn't bear any weight on the object's configurations. If an object's config file explicitly has the notifications_enabled directive set to 0, this won't automagically change the config file. It just updates the "status" of the object.
Former Nagios employee
https://www.mcapra.com/
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: My Nagios Users Are Forgetful

Post by tmcdonald »

Thanks for the assist, @mcapra! That's essentially what I would suggest, although we do not have a ready-made script to do specifically that.
Former Nagios employee
Master_Chief_Jon
Posts: 23
Joined: Fri Nov 19, 2010 1:31 pm

Re: My Nagios Users Are Forgetful

Post by Master_Chief_Jon »

While I was waiting on a reply, I was "googling" for anyone else who had done this, and came across this URL: https://exchange.nagios.org/directory/A ... er/details It is a bash file that uses awk to parse status.dat and list any disabled host or service notifications. I tweaked that a bit and added code to re-enable each disabled notification. That's working now.
I think I like the grep idea better than using awk. I'll dig into that and see if it results in a neater script.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: My Nagios Users Are Forgetful

Post by npolovenko »

@Master_Chief_Jon, Sounds good. Thanks for sharing your solution with us!
Do you have any other questions for us so far?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Master_Chief_Jon
Posts: 23
Joined: Fri Nov 19, 2010 1:31 pm

Re: My Nagios Users Are Forgetful

Post by Master_Chief_Jon »

OK, I used the grep method to gather a list of host and service checks that have their notifications disabled. Then parsed that list to run the external command to re-enable each disabled host and service check. I'm good now. Thanks for your help.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: My Nagios Users Are Forgetful

Post by tmcdonald »

Glad to hear it! I'll be closing this up now, but feel free to open another thread if you need anything in the future!
Former Nagios employee
Locked